Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We borrow a reference to the static exceptions TypeError and ValueError and pass these objects to PyModule_AddObject, which steals a reference. In Python 3.11 and newer, Py_Finalize() deallocates static exceptions python/cpython#30805 This results in a crash on termination, because _PyStaticType_Dealloc indirectly calls _Py_Dealloc on the objects as the reference count drops to zero. The issue does not occur in Python 3.12 and newer because the objects are immortal. Signed-off-by: Emanuele Giaquinta <[email protected]>
- Loading branch information