File tree 2 files changed +17
-19
lines changed
2 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -85,3 +85,20 @@ PyAPI_FUNC(PyObject **) PyObject_GET_WEAKREFS_LISTPTR(PyObject *op);
85
85
86
86
PyAPI_FUNC (PyObject * ) PyUnstable_Object_GC_NewWithExtraData (PyTypeObject * ,
87
87
size_t );
88
+
89
+
90
+ /* Visit all live GC-capable objects, similar to gc.get_objects(None). The
91
+ * supplied callback is called on every such object with the void* arg set
92
+ * to the supplied arg. Returning 0 from the callback ends iteration, returning
93
+ * 1 allows iteration to continue. Returning any other value may result in
94
+ * undefined behaviour.
95
+ *
96
+ * If new objects are (de)allocated by the callback it is undefined if they
97
+ * will be visited.
98
+
99
+ * Garbage collection is disabled during operation. Explicitly running a
100
+ * collection in the callback may lead to undefined behaviour e.g. visiting the
101
+ * same objects multiple times or not at all.
102
+ */
103
+ typedef int (* gcvisitobjects_t )(PyObject * , void * );
104
+ PyAPI_FUNC (void ) PyUnstable_GC_VisitObjects (gcvisitobjects_t callback , void * arg );
Original file line number Diff line number Diff line change @@ -153,25 +153,6 @@ PyAPI_FUNC(int) PyGC_Enable(void);
153
153
PyAPI_FUNC (int ) PyGC_Disable (void );
154
154
PyAPI_FUNC (int ) PyGC_IsEnabled (void );
155
155
156
-
157
- #if !defined(Py_LIMITED_API )
158
- /* Visit all live GC-capable objects, similar to gc.get_objects(None). The
159
- * supplied callback is called on every such object with the void* arg set
160
- * to the supplied arg. Returning 0 from the callback ends iteration, returning
161
- * 1 allows iteration to continue. Returning any other value may result in
162
- * undefined behaviour.
163
- *
164
- * If new objects are (de)allocated by the callback it is undefined if they
165
- * will be visited.
166
-
167
- * Garbage collection is disabled during operation. Explicitly running a
168
- * collection in the callback may lead to undefined behaviour e.g. visiting the
169
- * same objects multiple times or not at all.
170
- */
171
- typedef int (* gcvisitobjects_t )(PyObject * , void * );
172
- PyAPI_FUNC (void ) PyUnstable_GC_VisitObjects (gcvisitobjects_t callback , void * arg );
173
- #endif
174
-
175
156
/* Test if a type has a GC head */
176
157
#define PyType_IS_GC (t ) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
177
158
You can’t perform that action at this time.
0 commit comments