site.py and the checkout builddir
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."
Benjamin Peterson <musiccomposition <at> gmail.com> writes:
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.
Since io.py imports _bytesio and _stringio, and io.py is always imported at startup, this option sounds harmless. Regards Antoine.
On Fri, Sep 5, 2008 at 4:51 PM, Antoine Pitrou <solipsis@pitrou.net> wrote:
Benjamin Peterson <musiccomposition <at> gmail.com> writes:
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.
Since io.py imports _bytesio and _stringio, and io.py is always imported at startup, this option sounds harmless.
Yeah, the only harm being that the python binary gets a little heftier. (Not a big issue, since 3.0's libpython is half a megabyte less than 2.6's)
Regards
Antoine.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/musiccomposition%40gmail.c...
-- Cheers, Benjamin Peterson "There's no place like 127.0.0.1."
Benjamin Peterson wrote:
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.
Oh, the modules are still shared libraries? That's clearly a mistake. It makes no sense to have both modules as shared libraries when they are loaded on every interpreter startup. +1 for making them builtin modules. Christian
participants (3)
-
Antoine Pitrou
-
Benjamin Peterson
-
Christian Heimes