From 65a5bf9d37a3b29eb394f560b9a09318196c40e8 Mon Sep 17 00:00:00 2001
From: shadchin <shadchin@yandex-team.com>
Date: Mon, 23 Dec 2024 19:39:02 +0300
Subject: Update Python 3 to 3.12.8
 commit_hash:c20045b8a987d8720e1f3328270357491d5530f3

---
 contrib/tools/python3/Python/pystate.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'contrib/tools/python3/Python/pystate.c')

diff --git a/contrib/tools/python3/Python/pystate.c b/contrib/tools/python3/Python/pystate.c
index 93fbbaaf01..c829f64431 100644
--- a/contrib/tools/python3/Python/pystate.c
+++ b/contrib/tools/python3/Python/pystate.c
@@ -691,7 +691,9 @@ init_interpreter(PyInterpreterState *interp,
                 _obmalloc_pools_INIT(interp->obmalloc.pools);
         memcpy(&interp->obmalloc.pools.used, temp, sizeof(temp));
     }
-    _PyObject_InitState(interp);
+
+    // We would call _PyObject_InitState() at this point
+    // if interp->feature_flags were alredy set.
 
     _PyEval_InitState(interp, pending_lock);
     _PyGC_InitState(&interp->gc);
@@ -1598,7 +1600,9 @@ tstate_delete_common(PyThreadState *tstate)
     if (tstate->_status.bound_gilstate) {
         unbind_gilstate_tstate(tstate);
     }
-    unbind_tstate(tstate);
+    if (tstate->_status.bound) {
+        unbind_tstate(tstate);
+    }
 
     // XXX Move to PyThreadState_Clear()?
     clear_datastack(tstate);
-- 
cgit v1.2.3