@@ -476,7 +476,7 @@ PyObject Slots
476
476
--------------
477
477
478
478
The 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 `,
480
480
usually called from a class statement). Note that :c:data: `PyType_Type ` (the
481
481
metatype) initializes :c:member: `~PyTypeObject.tp_itemsize `, which means that its instances (i.e.
482
482
type objects) *must * have the :attr: `ob_size ` field.
@@ -2000,6 +2000,17 @@ and :c:type:`PyType_Type` effectively act as defaults.)
2000
2000
For this field to be taken into account (even through inheritance),
2001
2001
you must also set the :const: `Py_TPFLAGS_HAVE_FINALIZE ` flags bit.
2002
2002
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
+
2003
2014
**Inheritance: **
2004
2015
2005
2016
This field is inherited by subtypes.
@@ -2024,17 +2035,6 @@ and :c:type:`PyType_Type` effectively act as defaults.)
2024
2035
.. versionadded :: 3.9 (the field exists since 3.8 but it's only used since 3.9)
2025
2036
2026
2037
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
-
2038
2038
.. _static-types :
2039
2039
2040
2040
Static Types
@@ -2440,7 +2440,8 @@ Async Object Structures
2440
2440
2441
2441
PyObject *am_aiter(PyObject *self);
2442
2442
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.
2444
2445
2445
2446
This slot may be set to ``NULL `` if an object does not implement
2446
2447
asynchronous iteration protocol.
0 commit comments