From 89350a41b969b1fb20d0e24db28a20491e448860 Mon Sep 17 00:00:00 2001 From: Neil Schemenauer Date: Sun, 17 Nov 2002 17:52:44 +0000 Subject: [PATCH] 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. --- Include/object.h | 1 - Objects/object.c | 7 ------- Python/pythonrun.c | 4 ---- 3 files changed, 12 deletions(-) diff --git a/Include/object.h b/Include/object.h index d045be16a0c..5e509b41a0f 100644 --- a/Include/object.h +++ b/Include/object.h @@ -559,7 +559,6 @@ PyAPI_FUNC(void) _Py_NewReference(PyObject *); PyAPI_FUNC(void) _Py_ForgetReference(PyObject *); PyAPI_FUNC(void) _Py_Dealloc(PyObject *); PyAPI_FUNC(void) _Py_PrintReferences(FILE *); -PyAPI_FUNC(void) _Py_ResetReferences(void); #else /* Without Py_TRACE_REFS, there's little enough to do that we expand code diff --git a/Objects/object.c b/Objects/object.c index 20a6a936c1c..33286435e90 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1908,13 +1908,6 @@ _Py_ReadyTypes(void) static PyObject refchain = {&refchain, &refchain}; -void -_Py_ResetReferences(void) -{ - refchain._ob_prev = refchain._ob_next = &refchain; - _Py_RefTotal = 0; -} - void _Py_NewReference(PyObject *op) { diff --git a/Python/pythonrun.c b/Python/pythonrun.c index b85c390a770..c2508fa579d 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -277,10 +277,6 @@ Py_Finalize(void) #endif call_ll_exitfuncs(); - -#ifdef Py_TRACE_REFS - _Py_ResetReferences(); -#endif /* Py_TRACE_REFS */ } /* Create and initialize a new interpreter and thread, and return the