From 49a7e97e6526a2b52ceb399b2d29e576fe19b5b4 Mon Sep 17 00:00:00 2001 From: da-woods Date: Sat, 18 Nov 2023 14:51:51 +0000 Subject: [PATCH 1/2] Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" Fix a small error in the documentation: `Py_TPFLAGS_MANAGED_WEAKREF` is set in the `tp_flags` field rather than the `tp_dict` field --- Doc/c-api/typeobj.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index 10c05beda7c66f0..cd0fbd9e10bff81 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -1599,7 +1599,7 @@ and :c:data:`PyType_Type` effectively act as defaults.) **Default:** If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the - :c:member:`~PyTypeObject.tp_dict` field, then + :c:member:`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative value, to indicate that it is unsafe to use this field. From 0ba1afd17be912cda03138e81b71cc39784f7665 Mon Sep 17 00:00:00 2001 From: da-woods Date: Sat, 18 Nov 2023 15:04:36 +0000 Subject: [PATCH 2/2] Correct a reference to `tp_weaklist` --- Doc/c-api/typeobj.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index cd0fbd9e10bff81..705feaf182174c2 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -1587,7 +1587,7 @@ and :c:data:`PyType_Type` effectively act as defaults.) weak references to the type object itself. It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit and - :c:member:`~PyTypeObject.tp_weaklist`. + :c:member:`~PyTypeObject.tp_weaklistoffset`. **Inheritance:**