8000 gh-102304: Move _Py_RefTotal to _PyRuntimeState by ericsnowcurrently · Pull Request #102543 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-102304: Move _Py_RefTotal to _PyRuntimeState #102543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix _Py_FinalizeRefTotal().
  • Loading branch information
ericsnowcurrently committed Mar 17, 2023
commit 2a11934d05632208839c21e0aae2afa45feb187c
2 changes: 1 addition & 1 deletion Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static Py_ssize_t last_final_reftotal = 0;
void
_Py_FinalizeRefTotal(_PyRuntimeState *runtime)
{
last_final_reftotal += get_global_reftotal(runtime);
last_final_reftotal = get_global_reftotal(runtime);
REFTOTAL(runtime) = 0;
}

Expand Down
6 changes: 3 additions & 3 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@ _PyRuntimeState_Init(_PyRuntimeState *runtime)
void
_PyRuntimeState_Fini(_PyRuntimeState *runtime)
{
/* The reftotal is cleared by _Py_FinalizeRefTotal(). */
assert(runtime->object_state.reftotal == 0);

if (gilstate_tss_initialized(runtime)) {
gilstate_tss_fini(runtime);
}
Expand All @@ -506,9 +509,6 @@ _PyRuntimeState_Fini(_PyRuntimeState *runtime)

#undef FREE_LOCK
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);

/* The reftotal is cleared by _Py_ClearRefTotal(). */
assert(runtime->object_state.reftotal == 0);
}

#ifdef HAVE_FORK
Expand Down
0