diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 2 | ||||
-rw-r--r-- | Python/hashtable.c | 1 | ||||
-rw-r--r-- | Python/pylifecycle.c | 25 | ||||
-rw-r--r-- | Python/pystate.c | 4 |
4 files changed, 17 insertions, 15 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 30dd717..971067e 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -3110,7 +3110,7 @@ _PyBuiltin_Init(PyInterpreterState *interp) * result, programs leaking references to None and False (etc) * couldn't be diagnosed by examining sys.getobjects(0). */ -#define ADD_TO_ALL(OBJECT) _Py_AddToAllObjects((PyObject *)(OBJECT), 0) +#define ADD_TO_ALL(OBJECT) _Py_AddToAllObjects((PyObject *)(OBJECT)) #else #define ADD_TO_ALL(OBJECT) (void)0 #endif diff --git a/Python/hashtable.c b/Python/hashtable.c index 4e22a1a..8f5e816 100644 --- a/Python/hashtable.c +++ b/Python/hashtable.c @@ -226,7 +226,6 @@ _Py_hashtable_set(_Py_hashtable_t *ht, const void *key, void *value) assert(entry == NULL); #endif - entry = ht->alloc.malloc(sizeof(_Py_hashtable_entry_t)); if (entry == NULL) { /* memory allocation failed */ diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 7d362af..ee5d498 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1956,31 +1956,30 @@ Py_FinalizeEx(void) // XXX Ensure finalizer errors are handled properly. finalize_interp_clear(tstate); - finalize_interp_delete(tstate->interp); - -#ifdef Py_REF_DEBUG - if (show_ref_count) { - _PyDebug_PrintTotalRefs(); - } - _Py_FinalizeRefTotal(runtime); -#endif - _Py_FinalizeAllocatedBlocks(runtime); #ifdef Py_TRACE_REFS /* Display addresses (& refcnts) of all objects still alive. * An address can be used to find the repr of the object, printed - * above by _Py_PrintReferences. - */ - + * above by _Py_PrintReferences. */ if (dump_refs) { _Py_PrintReferenceAddresses(tstate->interp, stderr); } - if (dump_refs_fp != NULL) { _Py_PrintReferenceAddresses(tstate->interp, dump_refs_fp); fclose(dump_refs_fp); } #endif /* Py_TRACE_REFS */ + + finalize_interp_delete(tstate->interp); + +#ifdef Py_REF_DEBUG + if (show_ref_count) { + _PyDebug_PrintTotalRefs(); + } + _Py_FinalizeRefTotal(runtime); +#endif + _Py_FinalizeAllocatedBlocks(runtime); + #ifdef WITH_PYMALLOC if (malloc_stats) { _PyObject_DebugMallocStats(stderr); diff --git a/Python/pystate.c b/Python/pystate.c index 01651d7..4a8808f 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -674,6 +674,7 @@ init_interpreter(PyInterpreterState *interp, _obmalloc_pools_INIT(interp->obmalloc.pools); memcpy(&interp->obmalloc.pools.used, temp, sizeof(temp)); } + _PyObject_InitState(interp); _PyEval_InitState(interp, pending_lock); @@ -1001,6 +1002,9 @@ PyInterpreterState_Delete(PyInterpreterState *interp) if (interp->id_mutex != NULL) { PyThread_free_lock(interp->id_mutex); } + + _PyObject_FiniState(interp); + free_interpreter(interp); } |