This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: build process adds CWD (null entry) to PYTHONPATH if PYTHONPATH is set in the build environment
Type: Stage: needs patch
Components: Build Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, ned.deily, r.david.murray
Priority: normal Keywords:

Created on 2011-06-08 03:10 by r.david.murray, last changed 2022-04-11 14:57 by admin.

Messages (4)
msg137894 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-06-08 03:10
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
msg137897 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-06-08 07:56
It's being called for hg:

   -DHGVERSION="\"`LC_ALL=C hg id -i .`\"" ...
msg137909 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-06-08 14:33
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.
msg137911 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-06-08 15:14
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.
History
Date User Action Args
2022-04-11 14:57:18adminsetgithub: 56491
2011-06-09 13:12:03eric.araujosetnosy: + eric.araujo

versions: - Python 3.1
2011-06-08 15:14:12r.david.murraysettitle: ABCMeta import error during build -> build process adds CWD (null entry) to PYTHONPATH if PYTHONPATH is set in the build environment
messages: + msg137911
versions: + Python 3.1, Python 2.7, Python 3.2
2011-06-08 14:33:50r.david.murraysetmessages: + msg137909
2011-06-08 07:56:00ned.deilysetnosy: + ned.deily
messages: + msg137897
2011-06-08 03:10:57r.david.murraycreate