From 099e80a9dfe83b2f9e8eeacdf34bbfde8e9eef05 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 10 Mar 2023 15:59:08 -0700 Subject: [PATCH] Swap out the failed tstate. --- Python/pylifecycle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index e80dd30c89dfd0..9145f0bfc4d7d7 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -2056,10 +2056,10 @@ new_interpreter(PyThreadState **tstate_p, const _PyInterpreterConfig *config) /* Oops, it didn't work. Undo it all. */ PyErr_PrintEx(0); + PyThreadState_Swap(save_tstate); PyThreadState_Clear(tstate); PyThreadState_Delete(tstate); PyInterpreterState_Delete(interp); - PyThreadState_Swap(save_tstate); return status; }