[Python-Dev] importlib is now bootstrapped (and what that means)

R. David Murray rdmurray at bitdance.com
Mon Apr 16 18:15:16 CEST 2012

On Mon, 16 Apr 2012 11:21:34 -0400, Brett Cannon <brett at python.org> wrote:
> On Mon, Apr 16, 2012 at 10:07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > > We have other instances of this (e.g. the Objects/typeslots.inc file
> > > is generated and checked in), but in the case of importlib, we have
> > > to use the ./python binary for freezing to avoid bytecode
> > > incompatibilities, which obviously is a problem if ./python isn't
> > > built yet.
> >
> > As for dependencies on byte code: we could consider using Cython instead
> > of freeze (not sure whether Cython would build the bootstrap correctly;
> > it may need to be fixed first). With that, we would get semi-readable
> > source code, which should also play more nicely with hg diffs. On the
> > down side, we would depend on Cython for evolving .
> >
> We could also just store the raw source code and use that if we are all
> willing to pay the performance cost of parsing and compiling the code at
> every startup.

I don't see how depending on Cython is better than depending on having
an existing Python.  If the only benefit is semi-readable code, surely
we do have source code for the pre-frozen module, and it is just a matter
of convincing hg that the bytecode is binary, not text?

Brett's earlier thought of compiling from source as a *fallback* makes
sense to me.  I'd rather not add overhead to startup that we can avoid.


More information about the Python-Dev mailing list