Skip to content

gh-135474: Don't run the GC in the middle of longobject operations #135475

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

Closed
wants to merge 2 commits into from

Conversation

Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Jun 13, 2025

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.

Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can do anything, so could easily cause the GC to run.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah drats. You're right. I will fix this by fixing the specialization then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants