Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 89350a4

Browse files
committed
Remove _Py_ResetReferences. Fixes bug #529750 "Circular reference makes
Py_Init crash". refchain cannot be cleared because objects can live across Py_Finalize() and Py_Initialize() if they are kept alive by circular references.
1 parent 6141812 commit 89350a4

3 files changed

Lines changed: 0 additions & 12 deletions

File tree

Include/object.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,6 @@ PyAPI_FUNC(void) _Py_NewReference(PyObject *);
559559
PyAPI_FUNC(void) _Py_ForgetReference(PyObject *);
560560
PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
561561
PyAPI_FUNC(void) _Py_PrintReferences(FILE *);
562-
PyAPI_FUNC(void) _Py_ResetReferences(void);
563562

564563
#else
565564
/* Without Py_TRACE_REFS, there's little enough to do that we expand code

Objects/object.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,13 +1908,6 @@ _Py_ReadyTypes(void)
19081908

19091909
static PyObject refchain = {&refchain, &refchain};
19101910

1911-
void
1912-
_Py_ResetReferences(void)
1913-
{
1914-
refchain._ob_prev = refchain._ob_next = &refchain;
1915-
_Py_RefTotal = 0;
1916-
}
1917-
19181911
void
19191912
_Py_NewReference(PyObject *op)
19201913
{

Python/pythonrun.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,6 @@ Py_Finalize(void)
277277
#endif
278278

279279
call_ll_exitfuncs();
280-
281-
#ifdef Py_TRACE_REFS
282-
_Py_ResetReferences();
283-
#endif /* Py_TRACE_REFS */
284280
}
285281

286282
/* Create and initialize a new interpreter and thread, and return the

0 commit comments

Comments
 (0)