New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build process adds CWD (null entry) to PYTHONPATH if PYTHONPATH is set in the build environment #56491
Comments
After a make distclean I'm seeing the following output during a build of default. It is possible my 2.7 install is borked, but I don't understand why python is apparently being called during a gcc step. The build seems to succeed. gcc -pthread -c -g -O0 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE \
-DHGVERSION="\"`LC_ALL=C hg id -i .`\"" \
-DHGTAG="\"`LC_ALL=C hg id -t .`\"" \
-DHGBRANCH="\"`LC_ALL=C hg id -b .`\"" \
-o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 62, in <module>
import os
File "/usr/lib/python2.7/os.py", line 398, in <module>
import UserDict
File "/usr/lib/python2.7/UserDict.py", line 83, in <module>
import _abcoll
File "/usr/lib/python2.7/_abcoll.py", line 11, in <module>
from abc import ABCMeta, abstractmethod
ImportError: cannot import name ABCMeta
Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 62, in <module>
import os
File "/usr/lib/python2.7/os.py", line 398, in <module>
import UserDict
File "/usr/lib/python2.7/UserDict.py", line 83, in <module>
import _abcoll
File "/usr/lib/python2.7/_abcoll.py", line 11, in <module>
from abc import ABCMeta, abstractmethod
ImportError: cannot import name ABCMeta
Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 62, in <module>
import os
File "/usr/lib/python2.7/os.py", line 398, in <module>
import UserDict
File "/usr/lib/python2.7/UserDict.py", line 83, in <module>
import _abcoll
File "/usr/lib/python2.7/_abcoll.py", line 11, in <module>
from abc import ABCMeta, abstractmethod
ImportError: cannot import name ABCMeta |
It's being called for hg: -DHGVERSION="" |
As far as I can tell my python2.7 installation is fine and bug free. hg is working fine when called from the command line. |
It turns out that I had a stray abc.py file in my current working directory as the result of some previous tests of module-load-order rules. That by itself wouldn't have triggered the problem, but in addition, I have PYTHONPATH set in my environment because I have the hg whitespace hook installed. Apparently the build process turns a non-empty PYTHONPATH into a null entry in the final computed PYTHONPATH it uses when hg is called, and this results in anything located in the CWD being loaded. I don't think this rises quite to the level of a security issue, since it applies only at build time, but it certainly seems like a bug. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: