Issue 1526785: current directory added to sys.path on win32 (original) (raw)
The current directory at the time python starts is added to sys.path as the 3rd item (usually), regardless of whether the python file run is in this directory. This is apparently due to getpythonregpath in getpathp.c returning "" when skiphome is true and there are 0 subkeys in the registry. Since this is != NULL, it is appended to the path after the library zip file is and later is expanded to the current directory.
Because of this, 'import string' fails when an empty re.py is in the current directory because this file is used when string tries to import re. I know it's not a good idea to have an empty re.py file, but I can't control what's on other people's machines.
I've been debugging this in python 2.4, but 2.5 beta 2 seems to have the same behavior. This fix may be to set machinepath and userpath to NULL if they are "".