On Tue, May 28, 2013 at 10:31 PM, Antoine Pitrou <solip...@pitrou.net> wrote:
> Le Tue, 28 May 2013 22:15:25 +1000,
> Nick Coghlan <ncogh...@gmail.com> a écrit :
>> I have a feature branch where I'm intermittently working on the
>> bootstrapping changes described in PEP 432.
>>
>> As part of those changes, I've cleaned up a few aspects of the repo
>> layout:
>>
>> * moved the main executable source file from Modules to a separate
>> Apps directory
>
> Sounds fine (I don't like "Apps" much, but hey :-)).

Unfortunately, I don't know any other short word for "things with main
functions that we ship to end users" :)

>> * moved the _freezeimportlib and _testembed source files from Modules
>> to a separate Tools directory
>
> Well, they should probably go to Apps too, no?

I wanted to split out "part of the build/test infrastructure" from
"shipped to end users", but I could also live with a simple "Bin"
directory that contained both kinds of executable.

>> * split the monster pythonrun.h/c pair into 3 separate header/impl
>> pairs:
>>    * bootstrap.h/bootstrap.c
>>    * shutdown.h/shutdown.c
>>    * pythonrun.h/pythonrun.c
>
> I don't think separating bootstrap from shutdown is a good idea. They
> are quite closely related since one undoes what the other did (and they
> may also use shared private functions or data).

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.

> 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

Cheers,
Nick.
_______________________________________________
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/archive%40mail-archive.com

Reply via email to