8000 [3.13] gh-126881: fix finalization of dtoa state (GH-126904) (#127395) · python/cpython@47b0f8f · GitHub
[go: up one dir, main page]

Skip to content

Commit 47b0f8f

Browse files
[3.13] gh-126881: fix finalization of dtoa state (GH-126904) (#127395)
gh-126881: fix finalization of dtoa state (GH-126904) (cherry picked from commit 762c603) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
1 parent 9bdb0ae commit 47b0f8f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix crash in finalization of dtoa state. Patch by Kumar Aditya.

Python/pylifecycle.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,6 @@ finalize_interp_clear(PyThreadState *tstate)
18691869
_PyXI_Fini(tstate->interp);
18701870
_PyExc_ClearExceptionGroupType(tstate->interp);
18711871
_Py_clear_generic_types(tstate->interp);
1872-
_PyDtoa_Fini(tstate->interp);
18731872

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

18921891
finalize_interp_types(tstate->interp);
18931892

1893+
/* Finalize dtoa at last so that finalizers calling repr of float doesn't crash */
1894+
_PyDtoa_Fini(tstate->interp);
1895+
18941896
/* Free any delayed free requests immediately */
18951897
_PyMem_FiniDelayed(tstate->interp);
18961898

0 commit comments

Comments
 (0)
0