This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年07月08日 21:48 by chris.jerdonek, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue-15299-failing-test.patch | chris.jerdonek, 2012年07月09日 14:10 | review | ||
| Messages (5) | |||
|---|---|---|---|
| msg165038 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年07月08日 21:48 | |
The pkgutil.ImpImporter documentation says that if dirname is None, ImpImporter(dirname) should create a PEP 302 importer that searches the current sys.path, plus any modules that are frozen or built-in: http://docs.python.org/dev/library/pkgutil.html#pkgutil.ImpImporter However, the iter_modules() method of an ImpImporter instance doesn't search sys.path if dirname is None. It returns a generator that always yields nothing. For example-- 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 ImpImporter >>> importer = ImpImporter() >>> list(importer.iter_modules()) [] Strictly speaking, one could say the documentation only applies to the find_module() method since that's the only method covered by the PEP 302 API However, iter_modules() is a public method. So I think that either iter_modules() should be fixed, made private, or else the documentation clarified by saying that searching sys.path does not apply to iter_modules(). I'm pretty sure though that iter_modules() should be fixed. This is because there are other functions in pkgutil that seem not to work because ImpImporter.iter_modules() behaves the way it does (specifically calling pkgutil.iter_modules() with path=None). |
|||
| msg165082 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年07月09日 13:18 | |
I'm working on a test for this. |
|||
| msg165083 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年07月09日 14:10 | |
Add failing tests. |
|||
| msg165455 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年07月14日 15:57 | |
In addition, before changing ImpImporter.iter_modules(), we should probably also add some tests of the method for values of self.path that do work (i.e. for when self.path is not None). The method is currently untested. I can work on adding tests for that over the next few days. |
|||
| msg165498 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年07月15日 03:43 | |
The pkgutil import emulation is being deprecated in 3.3 However, I'll use this as useful input for any new walk_packages tests added while resolving #15343 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:32 | admin | set | github: 59504 |
| 2012年07月15日 03:43:05 | ncoghlan | set | status: open -> closed resolution: wont fix messages: + msg165498 stage: needs patch -> resolved |
| 2012年07月14日 16:38:26 | brett.cannon | set | nosy:
- brett.cannon |
| 2012年07月14日 15:57:01 | chris.jerdonek | set | keywords:
+ easy messages: + msg165455 |
| 2012年07月14日 12:59:49 | eric.araujo | set | nosy:
+ brett.cannon, ncoghlan, eric.araujo |
| 2012年07月09日 14:10:17 | chris.jerdonek | set | files:
+ issue-15299-failing-test.patch keywords: + patch messages: + msg165083 stage: test needed -> needs patch |
| 2012年07月09日 13:18:34 | chris.jerdonek | set | messages:
+ msg165082 stage: test needed |
| 2012年07月09日 13:17:09 | Arfrever | set | nosy:
+ Arfrever |
| 2012年07月08日 21:49:04 | chris.jerdonek | set | title: ImpImporter(None).iter_modules() does not search sys.path -> pkgutil.ImpImporter(None).iter_modules() does not search sys.path |
| 2012年07月08日 21:48:06 | chris.jerdonek | create | |