@@ -476,7 +476,7 @@ PyObject Slots
476476--------------
477477
478478The type object structure extends the :c:type: `PyVarObject ` structure. The
479- :attr: `ob_size ` field is used for dynamic types (created by :func: `type_new `,
479+ :attr: `ob_size ` field is used for dynamic types (created by :func: `type_new `,
480480usually called from a class statement). Note that :c:data: `PyType_Type ` (the
481481metatype) initializes :c:member: `~PyTypeObject.tp_itemsize `, which means that its instances (i.e.
482482type objects) *must * have the :attr: `ob_size ` field.
@@ -2000,6 +2000,17 @@ and :c:type:`PyType_Type` effectively act as defaults.)
20002000 For this field to be taken into account (even through inheritance),
20012001 you must also set the :const: `Py_TPFLAGS_HAVE_FINALIZE ` flags bit.
20022002
2003+ Also, note that, in a garbage collected Python,
2004+ :c:member: `~PyTypeObject.tp_dealloc ` may be called from
2005+ any Python thread, not just the thread which created the object (if the object
2006+ becomes part of a refcount cycle, that cycle might be collected by a garbage
2007+ collection on any thread). This is not a problem for Python API calls, since
2008+ the thread on which tp_dealloc is called will own the Global Interpreter Lock
2009+ (GIL). However, if the object being destroyed in turn destroys objects from some
2010+ other C or C++ library, care should be taken to ensure that destroying those
2011+ objects on the thread which called tp_dealloc will not violate any assumptions
2012+ of the library.
2013+
20032014 **Inheritance: **
20042015
20052016 This field is inherited by subtypes.
@@ -2024,17 +2035,6 @@ and :c:type:`PyType_Type` effectively act as defaults.)
20242035 .. versionadded :: 3.9 (the field exists since 3.8 but it's only used since 3.9)
20252036
20262037
2027- Also, note that, in a garbage collected Python, :c:member: `~PyTypeObject.tp_dealloc ` may be called from
2028- any Python thread, not just the thread which created the object (if the object
2029- becomes part of a refcount cycle, that cycle might be collected by a garbage
2030- collection on any thread). This is not a problem for Python API calls, since
2031- the thread on which tp_dealloc is called will own the Global Interpreter Lock
2032- (GIL). However, if the object being destroyed in turn destroys objects from some
2033- other C or C++ library, care should be taken to ensure that destroying those
2034- objects on the thread which called tp_dealloc will not violate any assumptions
2035- of the library.
2036-
2037-
20382038.. _static-types :
20392039
20402040Static Types
@@ -2440,7 +2440,8 @@ Async Object Structures
24402440
24412441 PyObject *am_aiter(PyObject *self);
24422442
2443- Must return an :term: `awaitable ` object. See :meth: `__anext__ ` for details.
2443+ Must return an :term: `asynchronous iterator ` object.
2444+ See :meth: `__anext__ ` for details.
24442445
24452446 This slot may be set to ``NULL `` if an object does not implement
24462447 asynchronous iteration protocol.
0 commit comments