[Python-Dev] Structural cleanups to the main CPython repo

Antoine Pitrou solipsis at pitrou.net
Tue May 28 18:20:18 CEST 2013

Le Tue, 28 May 2013 23:07:37 +1000,
Nick Coghlan <ncoghlan at gmail.com> a écrit :
> It was deliberate - a big part of PEP 432 is making sure that all the
> interpreter state lives *in* the interpreter state (as part of the
> config struct). Splitting the two into separate compilation modules
> makes it possible to ensure that all communication goes via the
> interpreter configuration (statics in other modules are still a
> problem, but also mostly out of scope for PEP 432).
> I *really* want to get us to clean phase separation of "the
> interpreter is starting up", "the interpreter is running normally" and
> "the interpreter is shutting down". I found that to be incredibly
> difficult to do when they were all intermixed in one file, which is
> why I decided to enlist the compiler's help by separating them.

It sounds a bit exagerated. We have encoders and decoders in the same
(C) modules, compressors and decompressors ditto. Why not keep
initialization and finalization in the same source file too?

(how long are the resulting C files?)

> > I don't know what goes
> > in the remaining "pythonrun.c", could you detail a bit?
> While they have some of the PEP 432 changes in them, the header files
> in the branch give the general flavour of the separation:
> Bootstrap is mostly get/init type functions:
> https://bitbucket.org/ncoghlan/cpython_sandbox/src/ae7fef62b462fb6b559172bd4dbefc185ec28c40/Include/bootstrap.h?at=pep432_modular_bootstrap
> Pythonrun is mostly PyRun_*, PyParser_*, Py_Compile* and a few other
> odds and ends:
> https://bitbucket.org/ncoghlan/cpython_sandbox/src/ae7fef62b462fb6b559172bd4dbefc185ec28c40/Include/pythonrun.h?at=pep432_modular_bootstrap
> Shutdown covers the various finalisers, atexit handling, etc:
> https://bitbucket.org/ncoghlan/cpython_sandbox/src/ae7fef62b462fb6b559172bd4dbefc185ec28c40/Include/shutdown.h?at=pep432_modular_bootstrap

The fact that PyXXX_Init() and PyXXX_Fini() end up in different header
files look like a red flag to me, modularization-wise.

I agree to separate PyRun_* stuff from initialization/finalization
routines, though.



More information about the Python-Dev mailing list