https://github.com/python/cpython/commit/762c603a866146afc7db2591fb49605e0858e9b1
commit: 762c603a866146afc7db2591fb49605e0858e9b1
branch: main
author: Kumar Aditya <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2024-11-29T15:17:16+05:30
summary:
gh-126881: fix finalization of dtoa state (#126904)
files:
A
Misc/NEWS.d/next/Core_and_Builtins/2024-11-16-11-11-35.gh-issue-126881.ijofLZ.rst
M Python/pylifecycle.c
diff --git
a/Misc/NEWS.d/next/Core_and_Builtins/2024-11-16-11-11-35.gh-issue-126881.ijofLZ.rst
b/Misc/NEWS.d/next/Core_and_Builtins/2024-11-16-11-11-35.gh-issue-126881.ijofLZ.rst
new file mode 100644
index 00000000000000..13381c7630d7ce
--- /dev/null
+++
b/Misc/NEWS.d/next/Core_and_Builtins/2024-11-16-11-11-35.gh-issue-126881.ijofLZ.rst
@@ -0,0 +1 @@
+Fix crash in finalization of dtoa state. Patch by Kumar Aditya.
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 23882d083844ac..ceb30e9f02df2c 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1888,7 +1888,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);
@@ -1910,6 +1909,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);
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]