@@ -474,7 +474,7 @@ PyObject Slots
474474--------------
475475
476476The type object structure extends the :c:type: `PyVarObject ` structure. The
477- :attr: `ob_size ` field is used for dynamic types (created by :func: `type_new `,
477+ :attr: `ob_size ` field is used for dynamic types (created by :func: `type_new `,
478478usually called from a class statement). Note that :c:data: `PyType_Type ` (the
479479metatype) initializes :c:member: `~PyTypeObject.tp_itemsize `, which means that its instances (i.e.
480480type objects) *must * have the :attr: `ob_size ` field.
@@ -1909,6 +1909,17 @@ and :c:type:`PyType_Type` effectively act as defaults.)
19091909 For this field to be taken into account (even through inheritance),
19101910 you must also set the :const: `Py_TPFLAGS_HAVE_FINALIZE ` flags bit.
19111911
1912+ Also, note that, in a garbage collected Python,
1913+ :c:member: `~PyTypeObject.tp_dealloc ` may be called from
1914+ any Python thread, not just the thread which created the object (if the object
1915+ becomes part of a refcount cycle, that cycle might be collected by a garbage
1916+ collection on any thread). This is not a problem for Python API calls, since
1917+ the thread on which tp_dealloc is called will own the Global Interpreter Lock
1918+ (GIL). However, if the object being destroyed in turn destroys objects from some
1919+ other C or C++ library, care should be taken to ensure that destroying those
1920+ objects on the thread which called tp_dealloc will not violate any assumptions
1921+ of the library.
1922+
19121923 **Inheritance: **
19131924
19141925 This field is inherited by subtypes.
@@ -1933,17 +1944,6 @@ and :c:type:`PyType_Type` effectively act as defaults.)
19331944 .. versionadded :: 3.9 (the field exists since 3.8 but it's only used since 3.9)
19341945
19351946
1936- Also, note that, in a garbage collected Python, :c:member: `~PyTypeObject.tp_dealloc ` may be called from
1937- any Python thread, not just the thread which created the object (if the object
1938- becomes part of a refcount cycle, that cycle might be collected by a garbage
1939- collection on any thread). This is not a problem for Python API calls, since
1940- the thread on which tp_dealloc is called will own the Global Interpreter Lock
1941- (GIL). However, if the object being destroyed in turn destroys objects from some
1942- other C or C++ library, care should be taken to ensure that destroying those
1943- objects on the thread which called tp_dealloc will not violate any assumptions
1944- of the library.
1945-
1946-
19471947.. _heap-types :
19481948
19491949Heap Types
@@ -2340,7 +2340,8 @@ Async Object Structures
23402340
23412341 PyObject *am_aiter(PyObject *self);
23422342
2343- Must return an :term: `awaitable ` object. See :meth: `__anext__ ` for details.
2343+ Must return an :term: `asynchronous iterator ` object.
2344+ See :meth: `__anext__ ` for details.
23442345
23452346 This slot may be set to ``NULL `` if an object does not implement
23462347 asynchronous iteration protocol.
0 commit comments