Title: Move main functions to a separate Programs directory
Type: enhancement Stage: resolved
Components: Build, Interpreter Core Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, barry, dilettant, eric.snow, ezio.melotti, haypo, ncoghlan, python-dev, tshepang, zach.ware
Priority: normal Keywords: patch

Created on 2013-05-29 11:51 by ncoghlan, last changed 2014-09-25 09:49 by ncoghlan. This issue is now closed.

File name Uploaded Description Edit
move_programs.git.diff ncoghlan, 2013-05-29 11:51 hg export --git review
test_capi.patch haypo, 2014-09-25 08:20 review
Messages (14)
msg190292 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2013-05-29 11:51
This patch moves the C level main functions for python, _testembed and _freeze_importlib to a new Programs directory.

I added README files with my current understanding of the expected contents of the Python, Objects, Modules and Programs directories and also attempted to update the Windows builds (which don't appear to include _testembed at all).
msg190408 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-05-31 15:52
I can confirm that the patch doesn't break building on Windows.

Would it make any sense to move Windows-specific sources for things like kill_python.exe (PCbuild/kill_python.c), make_buildinfo.exe, make_versioninfo.exe, py.exe (PC/launcher.c) into Programs?  Or better to keep them in PC or PCbuild (at least for now, until after this patch is approved)?
msg192267 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2013-07-04 02:37
Looks good to me.  What else needs to be done in this area that will help with work on PEP 432?
msg192268 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2013-07-04 03:32
What about Modules/main.c?
msg223936 - (view) Author: Roundup Robot (python-dev) Date: 2014-07-25 11:53
New changeset 88a532a31eb3 by Nick Coghlan in branch 'default':
Issue #18093: Factor out the programs that embed the runtime
msg223937 - (view) Author: Roundup Robot (python-dev) Date: 2014-07-25 11:55
New changeset 7640af73c19d by Nick Coghlan in branch 'default':
Add missing NEWS entry for issue #18093
msg223939 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-07-25 12:04
Prompted to finally get back to this by the python-dev discussion about PEP 432 (as separating these out helps keep the moving parts clear when working on the startup sequence)

In response to Eric's question, Modules/main.c is part of the CPython runtime, rather than a C application that embeds the runtime. The "main" in the name refers to the exported Py_Main, rather than a C main function.

The *actual* C level main function now lives in Programs/python.c (previously Modules/python.c) and calls Py_Main after doing a bit of fiddling about with the command line arguments and the floating point settings.
msg223941 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-07-25 12:49
Zach, regarding the Windows executables - up to you if you want to open an issue to move them. These ones I particularly wanted to move because I found having them in Modules to be genuinely confusing when working on the startup code.
msg223953 - (view) Author: Roundup Robot (python-dev) Date: 2014-07-25 13:58
New changeset 766570a5d607 by Zachary Ware in branch 'default':
Issue #18093: Give the Windows build _testembed.c's new location.
msg223989 - (view) Author: Roundup Robot (python-dev) Date: 2014-07-25 19:42
New changeset 413017768dde by Ned Deily in branch 'default':
Issue #18093: Create Programs directory in build location for
msg227513 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2014-09-25 07:51
_testembed was moved from Modules to Programs but test_capi was not updated: it still looks for test_embed in Modules.

$ ./configure --with-pydebug
$ make
$ ./python -m test -v test_capi
test_forced_io_encoding (test.test_capi.EmbeddingTests) ... skipped "'/home/haypo/prog/python/default/Modules/_testembed' doesn't exist"
test_subinterps (test.test_capi.EmbeddingTests) ... skipped "'/home/haypo/prog/python/default/Modules/_testembed' doesn't exist"
msg227514 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2014-09-25 08:20
test_capi.patch fixes test_capi to be able to run _testembed in test_capi.
msg227518 - (view) Author: Roundup Robot (python-dev) Date: 2014-09-25 09:48
New changeset c87e00a6258d by Nick Coghlan in branch 'default':
Issue #18093: fix test_capi test skip due to _testembed move
msg227519 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-09-25 09:49
Thanks for spotting that Victor - should be fixed by that last commit with your change.
Date User Action Args
2014-09-25 09:49:27ncoghlansetstatus: open -> closed
resolution: fixed
messages: + msg227519
2014-09-25 09:48:40python-devsetmessages: + msg227518
2014-09-25 08:20:01hayposetfiles: + test_capi.patch

messages: + msg227514
2014-09-25 07:51:34hayposetstatus: closed -> open

nosy: + haypo
messages: + msg227513

resolution: fixed -> (no value)
2014-08-24 00:17:23ncoghlanlinkissue22257 dependencies
2014-07-25 19:42:17python-devsetmessages: + msg223989
2014-07-25 13:58:26python-devsetmessages: + msg223953
2014-07-25 12:49:59ncoghlansetmessages: + msg223941
2014-07-25 12:04:08ncoghlansetstatus: open -> closed
resolution: fixed
messages: + msg223939

stage: patch review -> resolved
2014-07-25 11:55:28python-devsetmessages: + msg223937
2014-07-25 11:53:07python-devsetnosy: + python-dev
messages: + msg223936
2013-07-04 03:32:17eric.snowsetmessages: + msg192268
2013-07-04 02:37:51eric.snowsetmessages: + msg192267
2013-06-27 05:22:02eric.snowsetnosy: + eric.snow
2013-05-31 15:52:04zach.waresetnosy: + zach.ware
messages: + msg190408
2013-05-30 06:33:52ezio.melottisetnosy: + ezio.melotti
2013-05-30 06:02:41Arfreversetnosy: + Arfrever
2013-05-29 16:36:50tshepangsetnosy: + tshepang
2013-05-29 14:34:12dilettantsetnosy: + dilettant
2013-05-29 12:48:00barrysetnosy: + barry
2013-05-29 11:55:11ncoghlansetmessages: - msg190293
2013-05-29 11:54:26ncoghlansetfiles: - move_programs.diff
2013-05-29 11:52:56ncoghlansetmessages: + msg190293
2013-05-29 11:51:51ncoghlansetfiles: + move_programs.git.diff
2013-05-29 11:51:30ncoghlancreate