[Python-Dev] site.py and the checkout builddir
Benjamin Peterson
musiccomposition at gmail.com
Fri Sep 5 23:38:41 CEST 2008
In a checkout, site.py is currently responsible for adding the
distutils extension module builddir to sys.path. Usually, this is
unproblematic. However, when the initialization code needed by site
(in this case the standard io streams and the builtin open) relies on
C modules added from the builddir in site.py, it causes silent errors.
The calls to initstdio and initsite were moved to having the site
initialization first in r62778, so that _bytesio and _stringio could
be used when io was loaded. Unfortunately, site.py uses open, but this
error went undetected because stderr was not set up yet. (See issue
#3279)
That options as I see it are:
1. Switch the initialization order back to the original (io streams
first) and compile _bytesio and _stringio directly into the Python
binary. This is probably the easiest option.
2. Switch the initialization order back to the original and have
getpath.c put the builddir on sys.path. This might be difficult
because finding the distutils buildir seems to involve
disutils.utils.get_platform(). (I'm not a disutils expert; can the
location of the builddir be simplified?)
Anyway, note that this doesn't affect Python which has been installed
on a system because the dynlibs are already on sys.path.
--
Cheers,
Benjamin Peterson
"There's no place like 127.0.0.1."
More information about the Python-Dev
mailing list