[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 762c603a86)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Miss Islington (bot) 2024-11-29 11:52:21 +01:00 committed by GitHub
parent 9bdb0ae5dc
commit 47b0f8f297
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1 @@
Fix crash in finalization of dtoa state. Patch by Kumar Aditya.

View file

@ -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);
@ -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);