[issue14605] Make import machinery explicit

Brett Cannon report at bugs.python.org
Wed Apr 25 04:53:18 CEST 2012

Brett Cannon <brett at python.org> added the comment:

I found out why runpy was giving back an absolute file path for __file__; because pkgutil was doing that through its ImpLoader, unlike what import does by default which is just taking what path it has and appending file names (and thus not making anything absolute).

So I have simply forced runpy to make absolute paths of the files it is given. Nick, can you have a look and let me know if this fix is reasonable, or if another os.path.abspath() call is needed somewhere in runpy?

Added file: http://bugs.python.org/file25359/explicit_path_hooks.diff

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list