Skip to content

Commit

Permalink
pythongh-126881: fix finalization of dtoa state (pythonGH-126904)
Browse files Browse the repository at this point in the history
(cherry picked from commit 762c603)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
  • Loading branch information
kumaraditya303 authored and miss-islington committed Nov 29, 2024
1 parent d5a08f0 commit 4df6666
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix crash in finalization of dtoa state. Patch by Kumar Aditya.
4 changes: 3 additions & 1 deletion Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,6 @@ finalize_interp_clear(PyThreadState *tstate)
_PyXI_Fini(tstate->interp);
_PyExc_ClearExceptionGroupType(tstate->interp);
_Py_clear_generic_types(tstate->interp);
_PyDtoa_Fini(tstate->interp);

/* Clear interpreter state and all thread states */
_PyInterpreterState_Clear(tstate);
Expand All @@ -1891,6 +1890,9 @@ finalize_interp_clear(PyThreadState *tstate)

finalize_interp_types(tstate->interp);

/* Finalize dtoa at last so that finalizers calling repr of float doesn't crash */
_PyDtoa_Fini(tstate->interp);

/* Free any delayed free requests immediately */
_PyMem_FiniDelayed(tstate->interp);

Expand Down

0 comments on commit 4df6666

Please sign in to comment.