File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,8 @@ The following functions and structs are used to create
118
118
119
119
.. c :function :: PyObject* PyType_FromSpecWithBases (PyType_Spec *spec, PyObject *bases)
120
120
121
- Creates and returns a heap type object from the *spec *.
121
+ Creates and returns a heap type object from the *spec *
122
+ (:const: `Py_TPFLAGS_HEAPTYPE `).
122
123
123
124
If *bases* is a tuple, the created heap type contains all types contained
124
125
in it as base types.
Original file line number Diff line number Diff line change @@ -654,8 +654,8 @@ and :c:type:`PyType_Type` effectively act as defaults.)
654
654
the instance is still in existence, but there are no references to it. The
655
655
destructor function should free all references which the instance owns, free all
656
656
memory buffers owned by the instance (using the freeing function corresponding
657
- to the allocation function used to allocate the buffer), and finally (as its
658
- last action) call the type's :c:member: `~PyTypeObject.tp_free ` function. If the type is not
657
+ to the allocation function used to allocate the buffer), and then call the
658
+ type's :c:member: `~PyTypeObject.tp_free ` function. If the type is not
659
659
subtypable (doesn't have the :const: `Py_TPFLAGS_BASETYPE ` flag bit set), it is
660
660
permissible to call the object deallocator directly instead of via
661
661
:c:member: `~PyTypeObject.tp_free `. The object deallocator should be the one used to allocate the
@@ -664,6 +664,10 @@ and :c:type:`PyType_Type` effectively act as defaults.)
664
664
:c:func: `PyObject_GC_Del ` if the instance was allocated using
665
665
:c:func: `PyObject_GC_New ` or :c:func: `PyObject_GC_NewVar `.
666
666
667
+ Finally, if the type is heap allocated (:const: `Py_TPFLAGS_HEAPTYPE ` or
668
+ built with :c:func: `PyType_FromSpec `), the deallocator should decrement the
669
+ reference count for its type object.
670
+
667
671
**Inheritance: **
668
672
669
673
This field is inherited by subtypes.
You can’t perform that action at this time.
0 commit comments