https://github.com/python/cpython
Revision 27e27f7ee1f366e52cfd576b427e923190b6202e authored by Brett Cannon on 18 October 2013, 15:39:04 UTC, committed by Brett Cannon on 18 October 2013, 15:39:04 UTC
and stop importlib.machinery.FileFinder treating '' as '.'.

Previous PathFinder transformed '' into '.' which led to __file__ for
modules imported from the cwd to always be relative paths. This meant
the values of the attribute were wrong as soon as the cwd changed.
This change now means that as long as the site module is run (which
makes all entries in sys.path absolute) then all values for __file__
will also be absolute unless it's for __main__ when specified by file
path in a relative way (modules imported by runpy will have an
absolute path).

Now that PathFinder is no longer treating '' as '.' it only makes
sense for FileFinder to stop doing so as well. Now no transformation
is performed for the directory given to the __init__ method.

Thanks to Madison May for the initial patch.
1 parent 40b22d0
History
Tip revision: 27e27f7ee1f366e52cfd576b427e923190b6202e authored by Brett Cannon on 18 October 2013, 15:39:04 UTC
Issue #18416: Have importlib.machinery.PathFinder treat '' as the cwd
Tip revision: 27e27f7
File Mode Size
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Python
Tools
.bzrignore -rw-r--r-- 584 bytes
.gitignore -rw-r--r-- 960 bytes
.hgeol -rw-r--r-- 755 bytes
.hgignore -rw-r--r-- 1.2 KB
.hgtags -rw-r--r-- 5.7 KB
.hgtouch -rw-r--r-- 1.2 KB
LICENSE -rw-r--r-- 12.5 KB
Makefile.pre.in -rw-r--r-- 50.7 KB
README -rw-r--r-- 6.6 KB
config.guess -rwxr-xr-x 43.8 KB
config.sub -rwxr-xr-x 34.8 KB
configure -rwxr-xr-x 431.8 KB
configure.ac -rw-r--r-- 133.9 KB
install-sh -rwxr-xr-x 7.0 KB
pyconfig.h.in -rw-r--r-- 39.5 KB
setup.py -rw-r--r-- 94.4 KB

README

back to top