Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly untrack Python GC objects during deallocation.
Add PyObject_GC_UnTrack() in deallocation functions for Python types that have PyTPFLAGS_HAVE_GC set, either explicitly or by inheriting from a type with GC set. Not untracking before clearing instance data introduces potential race conditions (if GC happens to run between the partial clearing and the actual deallocation) and produces a warning under Python 3.11. (The warning then triggered an assertion failure, which only showed up when building in Py_DEBUG mode; this therefor also fixes that assertion failure.) PiperOrigin-RevId: 579827001
- Loading branch information
1 parent
d580fde
commit e32d094
Showing
3 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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