bpo-28254: Add a C-API for controlling the state of the garbage collector#25687
bpo-28254: Add a C-API for controlling the state of the garbage collector#25687vstinner merged 17 commits into
Conversation
|
Looks good, I will review it in more detail today, but please, add an entry to the what's new document for 3.10 in the meantime. |
Sorry, something went wrong.
…ions to make it easy for users to ('atomically') know whether they actually changed something and what state to go back to later. Also, returning an "int" may make it easier to add error handling later, if that becomes needed at some point.
|
Thanks for the PR @scoder! Make sure to merge it before end of the week 😉 |
Sorry, something went wrong.
|
I changed the functions to return the previous state. That's a common idiom in C, and I think a useful one in this case. |
Sorry, something went wrong.
|
Are the C functions prototypes defined in the right place? Limited API, header file hierarchy, etc.? |
Sorry, something went wrong.
… gc.collect() implementation).
…othing if GC is disabled.
You added them to the stable ABI and so you should run "regen-limited-abi". |
Sorry, something went wrong.
That added more than the three. I only committed the ones I added here in order to keep the PR clean. |
Sorry, something went wrong.
Right, thanks: https://bugs.python.org/issue43795#msg392212 |
Sorry, something went wrong.
Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner
left a comment
There was a problem hiding this comment.
LGTM but please fix the Sphinx markup.
Sorry, something went wrong.
vstinner
left a comment
There was a problem hiding this comment.
LGTM.
Sorry, something went wrong.
|
Merged, thanks @scoder! I'm not really excited by adding a C API for each Python function, but this one seems common enough to justify adding an API. Also, @pablogsal liked the idea ;-) |
Sorry, something went wrong.
The GC gods we all serve are pleased with the new API ;) |
Sorry, something went wrong.
|
Thanks Victor and Pablo! |
Sorry, something went wrong.
|
I created PR #25693 which shows how useful are these new C API functions ;-) Ok, maybe, it makes the C code a little bit simpler ;-) |
Sorry, something went wrong.
|
35 lines added, 116 lines saved. Seems a good deal. |
Sorry, something went wrong.
|
FYI, this has broken CI |
Sorry, something went wrong.
|
Yes, this adds things to From now on, CI will be fail on the pull request when issues like this happen, but this one's timing was unfortunate. |
Sorry, something went wrong.
https://bugs.python.org/issue28254