[issue2439] Patch to add a get_data function to pkgutil

Phillip J. Eby report at bugs.python.org
Fri Mar 21 00:28:52 CET 2008


Phillip J. Eby <pje at telecommunity.com> added the comment:

Oops, my bad.  I'm thinking of an entirely unrelated get_loader()
function.  Meanwhile, I misread your patch entirely, and thought you had
some dead code for os.path processing that is in fact live.  So there is
"another" problem (really the only one) that I spotted on this re-read.

Your patch is calling load_module() even if the module is already in
sys.modules.  This will *reload* the module, potentially causing
problems elsewhere in the system.  You can test this by adding an
assertion to your test's load_module(), that the module isn't already in
sys.modules.  Then call get_data for the same module twice.

Sorry again for the mixup.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2439>
__________________________________


More information about the Python-bugs-list mailing list