Skip to content

Conversation

@Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Nov 17, 2025

I can't produce a test case. Would appreciate if someone can do so.

The problem is that executors must be forcefully cleared upon invalidation, otherwise their reference cycles prevent clearing of invalid executors and those remain in the bytecode.

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
Py_DECREF(e);
executor->exits[i].executor = NULL;
if (e != cold && e != cold_dynamic) {
executor_clear((PyObject *)e);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
executor_clear((PyObject *)e);
Py_DECREF(e);

Using executor_clear could clear a live executor.

Copy link
Member Author

Choose a reason for hiding this comment

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

Py_DECREF doesn't work

The problem is that executors must be forcefully cleared upon invalidation, otherwise their reference cycles prevent clearing of invalid executors and those remain in the bytecode.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also executor_clear will never clear a live executor --- executor_clear only, unlinks, detaches, and decrefs an executor, it doesn't call PyObject_GC_DEL on it.

@bedevere-app
Copy link

bedevere-app bot commented Nov 17, 2025

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

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.

3 participants