Issue 15297: pkgutil.iter_importers() includes an ImpImporter (original) (raw)
Issue15297
Created on 2012-07-08 21:13 by chris.jerdonek, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Messages (4) | ||
---|---|---|
msg165035 - (view) | Author: Chris Jerdonek (chris.jerdonek) * ![]() |
Date: 2012-07-08 21:12 |
I'm not sure if this should be fixed in the code or in the documentation, but the pkgutil.iter_importers() documentation says that pkgutil.iter_importers(name) should yield the "importers for sys.meta_path, sys.path, and Python’s “classic” import machinery, in that order" when name does not include a ".": http://docs.python.org/dev/library/pkgutil.html#pkgutil.iter_importers However, the function appends a "non-classic" pkgutil.ImpImporter at the end of all that: Python 3.3.0b1 (default:5d43154d68a8, Jul 8 2012, 13:54:45) [GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.58)] on darwin >>> from pkgutil import iter_importers >>> list(iter_importers())[-1] <pkgutil.ImpImporter object at 0x1035fa840> | ||
msg165095 - (view) | Author: Ronan Lamy (Ronan.Lamy) * | Date: 2012-07-09 16:30 |
AFAICT, the intent of this function was to help provide a fully PEP-302 compliant import process wrapping the builtin C-implemented import mechanism. Nowadays, I believe that iterating over sys.meta_path should probably be enough. | ||
msg165099 - (view) | Author: Chris Jerdonek (chris.jerdonek) * ![]() |
Date: 2012-07-09 17:44 |
Marking this a documentation issue because the same behavior is also present in 2.7: Python 2.7.3 (default, Apr 19 2012, 00:55:09) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin >>> from pkgutil import iter_importers >>> list(iter_importers())[-1] <pkgutil.ImpImporter instance at 0x10517b710> | ||
msg165539 - (view) | Author: Chris Jerdonek (chris.jerdonek) * ![]() |
Date: 2012-07-15 17:25 |
Closing as this is no longer an issue after Nick's pkgutil changes documented in issue 15343. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:32 | admin | set | github: 59502 |
2012-07-15 17:25:16 | chris.jerdonek | set | status: open -> closedmessages: + |
2012-07-09 17:44:01 | chris.jerdonek | set | assignee: docs@pythoncomponents: + Documentation, - Library (Lib)versions: + Python 2.7keywords: + easynosy: + docs@pythonmessages: + |
2012-07-09 16:30:42 | Ronan.Lamy | set | nosy: + Ronan.Lamymessages: + |
2012-07-09 13:16:45 | Arfrever | set | nosy: + Arfrever |
2012-07-08 21:13:00 | chris.jerdonek | create |