Skip to content

Commit 194c6fb

Browse files
authored
gh-106320: Don't export _Py_ForgetReference() function (#108712)
There is no need to export the _Py_ForgetReference() function of the Py_TRACE_REFS build. It's not used by shared extensions. Enhance also its comment.
1 parent 9c03215 commit 194c6fb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Include/internal/pycore_object.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ extern void _PyDebugAllocatorStats(FILE *out, const char *block_name,
3232
extern void _PyObject_DebugTypeStats(FILE *out);
3333

3434
#ifdef Py_TRACE_REFS
35-
/* Py_TRACE_REFS is such major surgery that we call external routines. */
36-
PyAPI_FUNC(void) _Py_ForgetReference(PyObject *);
35+
// Forget a reference registered by _Py_NewReference(). Function called by
36+
// _Py_Dealloc().
37+
//
38+
// On a free list, the function can be used before modifying an object to
39+
// remove the object from traced objects. Then _Py_NewReference() or
40+
// _Py_NewReferenceNoTotal() should be called again on the object to trace
41+
// it again.
42+
extern void _Py_ForgetReference(PyObject *);
3743
#endif
3844

3945
// Export for shared _testinternalcapi extension

0 commit comments

Comments
 (0)