Skip to content

Commit a218bab

Browse files
vstinnerstefanseefeld
authored andcommitted
Fix enum_type_object type on Python 3.11
The enum_type_object type inherits from PyLong_Type which is not tracked by the GC. Instances doesn't have to be tracked by the GC: remove the Py_TPFLAGS_HAVE_GC flag. The Python C API documentation says: "To create a container type, the tp_flags field of the type object must include the Py_TPFLAGS_HAVE_GC and provide an implementation of the tp_traverse handler." https://docs.python.org/dev/c-api/gcsupport.html The new exception was introduced in Python 3.11 by: python/cpython#88429
1 parent 41e208e commit a218bab

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/object/enum.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ static PyTypeObject enum_type_object = {
113113
#if PY_VERSION_HEX < 0x03000000
114114
| Py_TPFLAGS_CHECKTYPES
115115
#endif
116-
| Py_TPFLAGS_HAVE_GC
117116
| Py_TPFLAGS_BASETYPE, /* tp_flags */
118117
0, /* tp_doc */
119118
0, /* tp_traverse */

0 commit comments

Comments
 (0)