-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Split pylifecycle.c out from pythonrun.c #67058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
When working on the original reference implementation for PEP-432, I found it useful to split the startup & shutdown code out from the main entry points into the eval loop (see bpo-22257 for more details). However, that split made the draft implementation rather hard to maintain - any CPython commit that touched pythonrun.c was almost certain to cause a merge conflict. The attached patch is a preliminary split into two separate modules, with pythonrun continuing to hold the main eval loop entry points, while the startup and shutdown code moves into pylifecycle. This is an initial WIP patch (that nonetheless passes the test suite). I started work on it a few months ago, so I need to make sure that I've retained Victor's recent pythonrun changes. |
Incorporated pythonrun changes from 668e0bf30042, 6aaa0aab1e93 and d6fb87972dee into pylifecycle |
Known issues with the current split:
|
+1 on the principle.
You could make it an API in object.c.
Should be easy to fix as well :-) |
It turns out *all* the global config variations are in pydebug.h (and they're basically the only thing in there, aside from the environment variable access macro). That seems a little weird to me (perhaps historical due to the early global config variables being debugging related?), but for now I've just added a couple of comments cross referencing pydebug.h from pylifecycle.c and vice-versa. The latest version of the patch:
Since the extern declaration is actually there in pydebug.h, the reference to Py_InspectFlag from pythonrun.c is actually fine for now (although removing that direct reference will likely end up being part of the PEP-432 implementation). |
I think this is ready to go now, unless anyone spots any major flaws I missed. |
Oops, "global config variations" above should have been "global config variable declarations". I guess my brain decided that was too much typing and jammed the last two words together :) |
New changeset b9775a92c1d0 by Nick Coghlan in branch 'default': |
I'm not absolutely sure but I think this has broken the Windows builds with the following being typical of numerous errors. 2>main.obj : error LNK2019: unresolved external symbol _Py_Finalize referenced in function _Py_Main |
Thanks. The Windows build files (Visual Studio project files) typically have to be updated when a new C file is added to the source tree. Probably one of our Windows experts can help with that :-) |
New changeset 31fd106bb68a by Steve Dower in branch 'default': |
Fixed. (I was conveniently sitting waiting for other things to build...) |
2> getbuildinfo.c Still with you or have I got finger trouble? :) |
Looks like a few Windows only things were missed. Can you track them down and get them into a patch? I'm out of time to do more right now. |
Out of my depth I'm afraid, sorry :( |
New changeset e7df0a47af16 by Steve Dower in branch 'default': |
That should be the last fix for Windows - a bit of code that was copied into the new file but not removed from the old one. |
Steve, I was actually just minutes away from committing the same fix in the opposite direction when I got the notification of your commit. Nick will correct me if I'm wrong but I think PyOS_CheckStack was supposed to stay in pythonrun.c, especially since it's still declared in pythonrun.h. |
You may be right, I didn't think of looking in the include files. I assumed that it was copied without being removed, rather than the copy itself being accidental. Feel free to move it back. |
New changeset 406965684327 by Zachary Ware in branch 'default': |
Thanks folks - Zach's right, that wasn't supposed to move. I missed the second copy in pylifecycle.c because it's all #ifdef'ed out on Linux, so the linker didn't complain about the duplication. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: