[Python-Dev] a new type for sys.implementation

Maciej Fijalkowski fijall at gmail.com
Fri Jun 1 11:16:36 CEST 2012


On Thu, May 31, 2012 at 6:56 PM, Benjamin Peterson <benjamin at python.org>wrote:

> 2012/5/31 Nick Coghlan <ncoghlan at gmail.com>:
> > On Thu, May 31, 2012 at 8:26 PM, Mark Shannon <mark at hotpy.org> wrote:
> >> Eric Snow wrote:
> >>>
> >>> The implementation for sys.implementation is going to use a new (but
> >>> "private") type[1].  It's basically equivalent to the following:
> >>
> >>
> >> Does this really need to be written in C rather than Python?
> >
> > Yes, because we want to use it in the sys module. As you get lower
> > down in the interpreter stack, implementing things in Python actually
> > starts getting painful because of bootstrapping issues (e.g. that's
> > why both _structseq and collections.namedtuple exist).
>
> sys.implementation could be added by site or some other startup file.
>
>
Yes, why not do that instead of a new thing in C? I don't care about PyPy
actually (since we kind of have to implement sys.implementation in
python/RPython anyway, since it'll be different) but more that more code in
C means more trouble usually.

Another question (might be out of topic here). What we do in PyPy to avoid
bootstrapping issues (since we have quite a bit implemented in Python,
rather than RPython) is to "freeze" the bytecode at compile time (or make
time) and put it in the executable. This avoids all sort of filesystem
access issues, but might be slightly too complicated.

Cheers,
fijal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120601/323c9ba3/attachment.html>


More information about the Python-Dev mailing list