bpo-32604: Clean up created subinterpreters before runtime finalization. (gh-5710)

(cherry picked from commit 4c6955e2b0)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-02-16 18:15:24 -08:00 committed by Eric Snow
parent 803e1a5722
commit 3db05a3a9c
5 changed files with 410 additions and 31 deletions

View file

@ -69,6 +69,10 @@ PyAPI_FUNC(void) _PyPathConfig_Clear(_PyPathConfig *config);
PyAPI_FUNC(PyInterpreterState *) _PyInterpreterState_LookUpID(PY_INT64_T);
PyAPI_FUNC(int) _PyInterpreterState_IDInitref(PyInterpreterState *);
PyAPI_FUNC(void) _PyInterpreterState_IDIncref(PyInterpreterState *);
PyAPI_FUNC(void) _PyInterpreterState_IDDecref(PyInterpreterState *);
/* cross-interpreter data */

View file

@ -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 @@ typedef struct _is {
struct _ts *tstate_head;
int64_t id;
int64_t id_refcount;
PyThread_type_lock id_mutex;
PyObject *modules;
PyObject *modules_by_index;