Message155018
If you run pkgutil.iter_zipimport_modules with a prefix parameter, and the module in question is a package, then the prefix parameter is ignored.
The most visible symptom of this is when running pkgutil.walk_packages for a zipfile. Imagine we have a module structure like this (or create one):
a/
a/__init__.py
a/b/
a/b/__init.__py
If we put this structure in a directory, add the directory to sys.path, and run pkgutil.walk_packages(), it will find modules "a" and "a.b".
If we put this structure in a zipfile, however, we add this file to sys.path, and run pkgutil.walk_packages(), it will find modules "a" and "b". This is because pkgutil.iter_zipimport_modules ignores the prefix parameter "a.".
This is incorrect.
This can be fixed by changing line ~344 of Lib/pkgutil.py from:
yield fn[0], True
to
yield prefix + fn[0], True
Thanks, James
P.s, This is my first Python bug report. I apologise in advance for any poor etiquette. |
|
Date |
User |
Action |
Args |
2012-03-06 15:02:24 | James.Pickering | set | recipients:
+ James.Pickering |
2012-03-06 15:02:24 | James.Pickering | set | messageid: <1331046144.89.0.833633660995.issue14209@psf.upfronthosting.co.za> |
2012-03-06 15:02:24 | James.Pickering | link | issue14209 messages |
2012-03-06 15:02:23 | James.Pickering | create | |
|