bpo-32604: Clean up created subinterpreters before runtime finalization. (gh-5710)
(cherry picked from commit 4c6955e2b0ccf88c705f8d1fac685a8e65f9699e)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
diff --git a/Include/pystate.h b/Include/pystate.h
index a19c1ed..29d7148 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -8,6 +8,8 @@
extern "C" {
#endif
+#include "pythread.h"
+
/* This limitation is for performance and simplicity. If needed it can be
removed (with effort). */
#define MAX_CO_EXTRA_USERS 255
@@ -111,6 +113,8 @@
struct _ts *tstate_head;
int64_t id;
+ int64_t id_refcount;
+ PyThread_type_lock id_mutex;
PyObject *modules;
PyObject *modules_by_index;