@@ -474,7 +474,7 @@ PyObject Slots
474
474
--------------
475
475
476
476
The 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 `,
478
478
usually called from a class statement). Note that :c:data: `PyType_Type ` (the
479
479
metatype) initializes :c:member: `~PyTypeObject.tp_itemsize `, which means that its instances (i.e.
480
480
type objects) *must * have the :attr: `ob_size ` field.
@@ -1909,6 +1909,17 @@ and :c:type:`PyType_Type` effectively act as defaults.)
1909
1909
For this field to be taken into account (even through inheritance),
1910
1910
you must also set the :const: `Py_TPFLAGS_HAVE_FINALIZE ` flags bit.
1911
1911
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
+
1912
1923
**Inheritance: **
1913
1924
1914
1925
This field is inherited by subtypes.
@@ -1933,17 +1944,6 @@ and :c:type:`PyType_Type` effectively act as defaults.)
1933
1944
.. versionadded :: 3.9 (the field exists since 3.8 but it's only used since 3.9)
1934
1945
1935
1946
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
-
1947
1947
.. _heap-types :
1948
1948
1949
1949
Heap Types
@@ -2340,7 +2340,8 @@ Async Object Structures
2340
2340
2341
2341
PyObject *am_aiter(PyObject *self);
2342
2342
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.
2344
2345
2345
2346
This slot may be set to ``NULL `` if an object does not implement
2346
2347
asynchronous iteration protocol.
0 commit comments