[issue21749] pkgutil ImpLoader does not support frozen modules

Marc-Andre Lemburg report at bugs.python.org
Fri Jun 13 16:08:31 CEST 2014


New submission from Marc-Andre Lemburg:

This leads to problems when using runpy, since it relies on pkgutil to find importers.

In Python 2, ImpLoader is used by ImpImporter which is used as fallback importer by get_importer(). get_importer() is used by runpy to implement e.g. the -m option. As a result, -m doesn't work with frozen modules.

In Python 3, ImpLoader still exists, but is deprecated. get_importer() also no longer falls back to the ImpImporter as default, so the situation is less bothersome.

Here's a patch for Python 3.4.1 which shows how to add support for frozen modules. The same patch also works in Python 2.6 and 2.7.

----------
components: Distutils, Library (Lib)
files: pkgutil-frozen-modules-support.patch
keywords: patch
messages: 220442
nosy: dstufft, eric.araujo, lemburg
priority: normal
severity: normal
status: open
title: pkgutil ImpLoader does not support frozen modules
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35617/pkgutil-frozen-modules-support.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21749>
_______________________________________


More information about the Python-bugs-list mailing list