gh-141648: Fix clearing of executors#141649
gh-141648: Fix clearing of executors#141649Fidget-Spinner wants to merge 5 commits intopython:mainfrom
Conversation
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); |
There was a problem hiding this comment.
| executor_clear((PyObject *)e); | |
| Py_DECREF(e); |
Using executor_clear could clear a live executor.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
When you're done making the requested changes, leave the comment: |
|
Py_DECREF here is wrong. |
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @markshannon: please review the changes made to this pull request. |
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.