[Python-Dev] Bug in 3.1.2 site.py

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Aug 9 10:34:26 CEST 2010


I think I've found a bug in the site.py of 3.1.2.
The following piece of code tries to make the modules
that are normally installed under lib-dynload available
when running from the build directory:

     """Append ./build/lib.<platform> in case we're running in the build dir
     (especially for Guido :-)"""
     from distutils.util import get_platform
     s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
     if hasattr(sys, 'gettotalrefcount'):
         s += '-pydebug'
     s = os.path.join(os.path.dirname(sys.path[-1]), s)
     sys.path.append(s)

However, it doesn't always work, because distutils.util.get_platform
tries to find a Makefile in the install location, which
doesn't exist if the Python you're building has never been
installed!

-- 
Greg


More information about the Python-Dev mailing list