| 1 |
From a218babc8daee904a83f550fb66e5cb3f1cb3013 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Victor Stinner <[email protected]> |
| 3 |
Date: Mon, 25 Apr 2022 10:51:46 +0200 |
| 4 |
Subject: [PATCH] Fix enum_type_object type on Python 3.11 |
| 5 |
|
| 6 |
The enum_type_object type inherits from PyLong_Type which is not tracked |
| 7 |
by the GC. Instances doesn't have to be tracked by the GC: remove the |
| 8 |
Py_TPFLAGS_HAVE_GC flag. |
| 9 |
|
| 10 |
The Python C API documentation says: |
| 11 |
|
| 12 |
"To create a container type, the tp_flags field of the type object |
| 13 |
must include the Py_TPFLAGS_HAVE_GC and provide an implementation of |
| 14 |
the tp_traverse handler." |
| 15 |
|
| 16 |
https://docs.python.org/dev/c-api/gcsupport.html |
| 17 |
|
| 18 |
The new exception was introduced in Python 3.11 by: |
| 19 |
https://github.com/python/cpython/issues/88429 |
| 20 |
--- |
| 21 |
src/object/enum.cpp | 1 - |
| 22 |
1 file changed, 1 deletion(-) |
| 23 |
|
| 24 |
diff --git a/src/object/enum.cpp b/src/object/enum.cpp |
| 25 |
index 293e7058991721f60c5b1ff89fcd2406a11531fb..5753b32e0742605ade7d929f2e766a78e3cfda7f 100644 |
| 26 |
--- a/src/object/enum.cpp |
| 27 |
+++ b/src/object/enum.cpp |
| 28 |
@@ -113,7 +113,6 @@ static PyTypeObject enum_type_object = { |
| 29 |
#if PY_VERSION_HEX < 0x03000000 |
| 30 |
| Py_TPFLAGS_CHECKTYPES |
| 31 |
#endif |
| 32 |
- | Py_TPFLAGS_HAVE_GC |
| 33 |
| Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| 34 |
0, /* tp_doc */ |
| 35 |
0, /* tp_traverse */ |