gh-135474: Don't run the GC in the middle of longobject operations#135475
Closed
Fidget-Spinner wants to merge 2 commits into
Closed
gh-135474: Don't run the GC in the middle of longobject operations#135475Fidget-Spinner wants to merge 2 commits into
Fidget-Spinner wants to merge 2 commits into
Conversation
markshannon
reviewed
Jun 13, 2025
markshannon
left a comment
Member
There was a problem hiding this comment.
I'm not sure that we can do this safely.
I think we might need to restrict ourselves to specializing for compact ints and avoiding the potentially long-running big int versions of add/subtract and multiply.
| PyThreadState *tstate = _PyThreadState_GET(); | ||
|
|
||
| #if defined(Py_REMOTE_DEBUG) && defined(Py_SUPPORTS_REMOTE_DEBUG) | ||
| _PyRunRemoteDebugger(tstate); |
Member
There was a problem hiding this comment.
This can do anything, so could easily cause the GC to run.
Member
Author
There was a problem hiding this comment.
Ah drats. You're right. I will fix this by fixing the specialization then.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is safe to do because we only allocate at the start of the operation, not in the midst of it. So the rss will never grow while we're checking for this.
Additionally, reading the comments in the codes suggest to me the point of checking for signals was for interrupts, not for GC.
So this should make things slightly faster.