summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-05-27 18:56:30 -0600
committerGitHub <noreply@github.com>2022-05-27 17:56:30 -0700
commit36374251aa39c0a89be277fb76439bacc709f8b7 (patch)
treea3bba5dee5d355f132201b514ba73ebe01838a16
parentcf63b80bc482ef971ecb6d3ed9a1dc4a93d73744 (diff)
downloadcpython-git-36374251aa39c0a89be277fb76439bacc709f8b7.tar.gz
[3.11] bpo-40514: Drop EXPERIMENTAL_ISOLATED_SUBINTERPRETERS (gh-93185) (GH-93306)
(cherry picked from commit caa279d6fd5f151e57f891cd4f6ba51b532501c6) This was added for bpo-40514 (gh-84694) to test out a per-interpreter GIL. However, it has since proven unnecessary to keep the experiment in the repo. (It can be done as a branch in a fork like normal.) So here we are removing: * the configure option * the macro * the code enabled by the macro Automerge-Triggered-By: GH:ericsnowcurrently
-rw-r--r--Doc/whatsnew/3.11.rst5
-rw-r--r--Include/internal/pycore_ceval.h4
-rw-r--r--Include/internal/pycore_interp.h3
-rw-r--r--Include/internal/pycore_pystate.h12
-rw-r--r--Include/internal/pycore_runtime.h2
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2022-05-25-12-30-12.gh-issue-84694.5sjy2w.rst2
-rw-r--r--Modules/_xxsubinterpretersmodule.c15
-rw-r--r--Modules/gcmodule.c8
-rw-r--r--Objects/typeobject.c25
-rw-r--r--Objects/unicodeobject.c18
-rw-r--r--Python/ceval.c55
-rw-r--r--Python/ceval_gil.h18
-rw-r--r--Python/preconfig.c10
-rw-r--r--Python/pylifecycle.c2
-rw-r--r--Python/pystate.c17
-rwxr-xr-xconfigure28
-rw-r--r--configure.ac17
-rw-r--r--pyconfig.h.in3
18 files changed, 10 insertions, 234 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 24d1343689..4f9bafefe2 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -1425,6 +1425,11 @@ Removed
Python's test suite."
(Contributed by Victor Stinner in :issue:`46852`.)
+* The ``--experimental-isolated-subinterpreters`` configure flag
+ (and corresponding ``EXPERIMENTAL_ISOLATED_SUBINTERPRETERS``)
+ have been removed.
+
+
Porting to Python 3.11
======================
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h
index 3efd6beb03..d969a5e6eb 100644
--- a/Include/internal/pycore_ceval.h
+++ b/Include/internal/pycore_ceval.h
@@ -80,11 +80,7 @@ _PyEval_Vector(PyThreadState *tstate,
PyObject* const* args, size_t argcount,
PyObject *kwnames);
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
-extern int _PyEval_ThreadsInitialized(PyInterpreterState *interp);
-#else
extern int _PyEval_ThreadsInitialized(struct pyruntimestate *runtime);
-#endif
extern PyStatus _PyEval_InitGIL(PyThreadState *tstate);
extern void _PyEval_FiniGIL(PyInterpreterState *interp);
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index d55627908a..bcfcd88d84 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -51,9 +51,6 @@ struct _ceval_state {
/* Request for dropping the GIL */
_Py_atomic_int gil_drop_request;
struct _pending_calls pending;
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- struct _gil_runtime_state gil;
-#endif
};
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index c4bc53c707..e2d7c5bee2 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -64,18 +64,10 @@ _Py_ThreadCanHandlePendingCalls(void)
/* Variable and macro for in-line access to current thread
and interpreter state */
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
-PyAPI_FUNC(PyThreadState*) _PyThreadState_GetTSS(void);
-#endif
-
static inline PyThreadState*
_PyRuntimeState_GetThreadState(_PyRuntimeState *runtime)
{
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- return _PyThreadState_GetTSS();
-#else
return (PyThreadState*)_Py_atomic_load_relaxed(&runtime->gilstate.tstate_current);
-#endif
}
/* Get the current Python thread state.
@@ -90,11 +82,7 @@ _PyRuntimeState_GetThreadState(_PyRuntimeState *runtime)
static inline PyThreadState*
_PyThreadState_GET(void)
{
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- return _PyThreadState_GetTSS();
-#else
return _PyRuntimeState_GetThreadState(&_PyRuntime);
-#endif
}
PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalError_TstateNULL(const char *func);
diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h
index 18191c3771..ae63ae74af 100644
--- a/Include/internal/pycore_runtime.h
+++ b/Include/internal/pycore_runtime.h
@@ -23,9 +23,7 @@ struct _ceval_runtime_state {
the main thread of the main interpreter can handle signals: see
_Py_ThreadCanHandleSignals(). */
_Py_atomic_int signals_pending;
-#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
struct _gil_runtime_state gil;
-#endif
};
/* GIL state */
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-05-25-12-30-12.gh-issue-84694.5sjy2w.rst b/Misc/NEWS.d/next/Core and Builtins/2022-05-25-12-30-12.gh-issue-84694.5sjy2w.rst
new file mode 100644
index 0000000000..c062d28b29
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-05-25-12-30-12.gh-issue-84694.5sjy2w.rst
@@ -0,0 +1,2 @@
+The ``--experimental-isolated-subinterpreters`` configure option and
+``EXPERIMENTAL_ISOLATED_SUBINTERPRETERS`` macro have been removed.
diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index 9b1f186c5b..d1df00111c 100644
--- a/Modules/_xxsubinterpretersmodule.c
+++ b/Modules/_xxsubinterpretersmodule.c
@@ -1932,20 +1932,6 @@ _run_script_in_interpreter(PyInterpreterState *interp, const char *codestr,
return -1;
}
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- // Switch to interpreter.
- PyThreadState *new_tstate = PyInterpreterState_ThreadHead(interp);
- PyThreadState *save1 = PyEval_SaveThread();
-
- (void)PyThreadState_Swap(new_tstate);
-
- // Run the script.
- _sharedexception *exc = NULL;
- int result = _run_script(interp, codestr, shared, &exc);
-
- // Switch back.
- PyEval_RestoreThread(save1);
-#else
// Switch to interpreter.
PyThreadState *save_tstate = NULL;
if (interp != PyInterpreterState_Get()) {
@@ -1963,7 +1949,6 @@ _run_script_in_interpreter(PyInterpreterState *interp, const char *codestr,
if (save_tstate != NULL) {
PyThreadState_Swap(save_tstate);
}
-#endif
// Propagate any exception out to the caller.
if (exc != NULL) {
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 45dad8f082..3bda6e4bb8 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -1195,14 +1195,6 @@ gc_collect_main(PyThreadState *tstate, int generation,
assert(gcstate->garbage != NULL);
assert(!_PyErr_Occurred(tstate));
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- if (tstate->interp->config._isolated_interpreter) {
- // bpo-40533: The garbage collector must not be run on parallel on
- // Python objects shared by multiple interpreters.
- return 0;
- }
-#endif
-
if (gcstate->debug & DEBUG_STATS) {
PySys_WriteStderr("gc: collecting generation %d...\n", generation);
show_stats_each_generations(gcstate);
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 1bcfd9a9c5..c1bae0b9a6 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -54,11 +54,6 @@ typedef struct PySlot_Offset {
} PySlot_Offset;
-/* bpo-40521: Interned strings are shared by all subinterpreters */
-#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
-# define INTERN_NAME_STRINGS
-#endif
-
static PyObject *
slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
@@ -4009,7 +4004,7 @@ type_setattro(PyTypeObject *type, PyObject *name, PyObject *value)
if (name == NULL)
return -1;
}
-#ifdef INTERN_NAME_STRINGS
+ /* bpo-40521: Interned strings are shared by all subinterpreters */
if (!PyUnicode_CHECK_INTERNED(name)) {
PyUnicode_InternInPlace(&name);
if (!PyUnicode_CHECK_INTERNED(name)) {
@@ -4019,7 +4014,6 @@ type_setattro(PyTypeObject *type, PyObject *name, PyObject *value)
return -1;
}
}
-#endif
}
else {
/* Will fail in _PyObject_GenericSetAttrWithDict. */
@@ -8456,17 +8450,11 @@ _PyTypes_InitSlotDefs(void)
for (slotdef *p = slotdefs; p->name; p++) {
/* Slots must be ordered by their offset in the PyHeapTypeObject. */
assert(!p[1].name || p->offset <= p[1].offset);
-#ifdef INTERN_NAME_STRINGS
+ /* bpo-40521: Interned strings are shared by all subinterpreters */
p->name_strobj = PyUnicode_InternFromString(p->name);
if (!p->name_strobj || !PyUnicode_CHECK_INTERNED(p->name_strobj)) {
return _PyStatus_NO_MEMORY();
}
-#else
- p->name_strobj = PyUnicode_FromString(p->name);
- if (!p->name_strobj) {
- return _PyStatus_NO_MEMORY();
- }
-#endif
}
slotdefs_initialized = 1;
return _PyStatus_OK();
@@ -8491,24 +8479,17 @@ update_slot(PyTypeObject *type, PyObject *name)
int offset;
assert(PyUnicode_CheckExact(name));
-#ifdef INTERN_NAME_STRINGS
assert(PyUnicode_CHECK_INTERNED(name));
-#endif
assert(slotdefs_initialized);
pp = ptrs;
for (p = slotdefs; p->name; p++) {
assert(PyUnicode_CheckExact(p->name_strobj));
assert(PyUnicode_CheckExact(name));
-#ifdef INTERN_NAME_STRINGS
+ /* bpo-40521: Using interned strings. */
if (p->name_strobj == name) {
*pp++ = p;
}
-#else
- if (p->name_strobj == name || _PyUnicode_EQ(p->name_strobj, name)) {
- *pp++ = p;
- }
-#endif
}
*pp = NULL;
for (pp = ptrs; *pp; pp++) {
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 656c7ccc8e..a7bd961c64 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -219,11 +219,6 @@ extern "C" {
# define OVERALLOCATE_FACTOR 4
#endif
-/* bpo-40521: Interned strings are shared by all interpreters. */
-#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
-# define INTERNED_STRINGS
-#endif
-
/* This dictionary holds all interned unicode strings. Note that references
to strings in this dictionary are *not* counted in the string's ob_refcnt.
When the interned string reaches a refcnt of 0 the string deallocation
@@ -232,9 +227,7 @@ extern "C" {
Another way to look at this is that to say that the actual reference
count of a string is: s->ob_refcnt + (s->state ? 2 : 0)
*/
-#ifdef INTERNED_STRINGS
static PyObject *interned = NULL;
-#endif
/* Forward declaration */
static inline int
@@ -1924,10 +1917,8 @@ unicode_dealloc(PyObject *unicode)
switch (PyUnicode_CHECK_INTERNED(unicode)) {
case SSTATE_NOT_INTERNED:
break;
-
case SSTATE_INTERNED_MORTAL:
{
-#ifdef INTERNED_STRINGS
/* Revive the dead object temporarily. PyDict_DelItem() removes two
references (key and value) which were ignored by
PyUnicode_InternInPlace(). Use refcnt=3 rather than refcnt=2
@@ -1941,7 +1932,6 @@ unicode_dealloc(PyObject *unicode)
}
assert(Py_REFCNT(unicode) == 1);
Py_SET_REFCNT(unicode, 0);
-#endif
break;
}
@@ -11314,13 +11304,11 @@ _PyUnicode_EqualToASCIIId(PyObject *left, _Py_Identifier *right)
if (PyUnicode_CHECK_INTERNED(left))
return 0;
-#ifdef INTERNED_STRINGS
assert(_PyUnicode_HASH(right_uni) != -1);
Py_hash_t hash = _PyUnicode_HASH(left);
if (hash != -1 && hash != _PyUnicode_HASH(right_uni)) {
return 0;
}
-#endif
return unicode_compare_eq(left, right_uni);
}
@@ -15562,7 +15550,6 @@ PyUnicode_InternInPlace(PyObject **p)
return;
}
-#ifdef INTERNED_STRINGS
if (PyUnicode_READY(s) == -1) {
PyErr_Clear();
return;
@@ -15593,11 +15580,6 @@ PyUnicode_InternInPlace(PyObject **p)
this. */
Py_SET_REFCNT(s, Py_REFCNT(s) - 2);
_PyUnicode_STATE(s).interned = SSTATE_INTERNED_MORTAL;
-#else
- // PyDict expects that interned strings have their hash
- // (PyASCIIObject.hash) already computed.
- (void)unicode_hash(s);
-#endif
}
void
diff --git a/Python/ceval.c b/Python/ceval.c
index 62379b4a85..b8b27a815f 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -348,21 +348,6 @@ _Py_FatalError_TstateNULL(const char *func)
"(the current Python thread state is NULL)");
}
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
-int
-_PyEval_ThreadsInitialized(PyInterpreterState *interp)
-{
- return gil_created(&interp->ceval.gil);
-}
-
-int
-PyEval_ThreadsInitialized(void)
-{
- // Fatal error if there is no current interpreter
- PyInterpreterState *interp = PyInterpreterState_Get();
- return _PyEval_ThreadsInitialized(interp);
-}
-#else
int
_PyEval_ThreadsInitialized(_PyRuntimeState *runtime)
{
@@ -375,25 +360,18 @@ PyEval_ThreadsInitialized(void)
_PyRuntimeState *runtime = &_PyRuntime;
return _PyEval_ThreadsInitialized(runtime);
}
-#endif
PyStatus
_PyEval_InitGIL(PyThreadState *tstate)
{
-#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
if (!_Py_IsMainInterpreter(tstate->interp)) {
/* Currently, the GIL is shared by all interpreters,
and only the main interpreter is responsible to create
and destroy it. */
return _PyStatus_OK();
}
-#endif
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- struct _gil_runtime_state *gil = &tstate->interp->ceval.gil;
-#else
struct _gil_runtime_state *gil = &tstate->interp->runtime->ceval.gil;
-#endif
assert(!gil_created(gil));
PyThread_init_thread();
@@ -408,20 +386,14 @@ _PyEval_InitGIL(PyThreadState *tstate)
void
_PyEval_FiniGIL(PyInterpreterState *interp)
{
-#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
if (!_Py_IsMainInterpreter(interp)) {
/* Currently, the GIL is shared by all interpreters,
and only the main interpreter is responsible to create
and destroy it. */
return;
}
-#endif
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- struct _gil_runtime_state *gil = &interp->ceval.gil;
-#else
struct _gil_runtime_state *gil = &interp->runtime->ceval.gil;
-#endif
if (!gil_created(gil)) {
/* First Py_InitializeFromConfig() call: the GIL doesn't exist
yet: do nothing. */
@@ -485,13 +457,9 @@ PyEval_AcquireThread(PyThreadState *tstate)
take_gil(tstate);
struct _gilstate_runtime_state *gilstate = &tstate->interp->runtime->gilstate;
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- (void)_PyThreadState_Swap(gilstate, tstate);
-#else
if (_PyThreadState_Swap(gilstate, tstate) != NULL) {
Py_FatalError("non-NULL old thread state");
}
-#endif
}
void
@@ -518,11 +486,7 @@ _PyEval_ReInitThreads(PyThreadState *tstate)
{
_PyRuntimeState *runtime = tstate->interp->runtime;
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- struct _gil_runtime_state *gil = &tstate->interp->ceval.gil;
-#else
struct _gil_runtime_state *gil = &runtime->ceval.gil;
-#endif
if (!gil_created(gil)) {
return _PyStatus_OK();
}
@@ -554,21 +518,12 @@ PyThreadState *
PyEval_SaveThread(void)
{
_PyRuntimeState *runtime = &_PyRuntime;
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- PyThreadState *old_tstate = _PyThreadState_GET();
- PyThreadState *tstate = _PyThreadState_Swap(&runtime->gilstate, old_tstate);
-#else
PyThreadState *tstate = _PyThreadState_Swap(&runtime->gilstate, NULL);
-#endif
_Py_EnsureTstateNotNULL(tstate);
struct _ceval_runtime_state *ceval = &runtime->ceval;
struct _ceval_state *ceval2 = &tstate->interp->ceval;
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- assert(gil_created(&ceval2->gil));
-#else
assert(gil_created(&ceval->gil));
-#endif
drop_gil(ceval, ceval2, tstate);
return tstate;
}
@@ -832,9 +787,7 @@ Py_MakePendingCalls(void)
void
_PyEval_InitRuntimeState(struct _ceval_runtime_state *ceval)
{
-#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
_gil_initialize(&ceval->gil);
-#endif
}
void
@@ -844,10 +797,6 @@ _PyEval_InitState(struct _ceval_state *ceval, PyThread_type_lock pending_lock)
assert(pending->lock == NULL);
pending->lock = pending_lock;
-
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- _gil_initialize(&ceval->gil);
-#endif
}
void
@@ -1262,13 +1211,9 @@ eval_frame_handle_pending(PyThreadState *tstate)
take_gil(tstate);
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- (void)_PyThreadState_Swap(&runtime->gilstate, tstate);
-#else
if (_PyThreadState_Swap(&runtime->gilstate, tstate) != NULL) {
Py_FatalError("orphan tstate");
}
-#endif
}
/* Check for asynchronous exception. */
diff --git a/Python/ceval_gil.h b/Python/ceval_gil.h
index 9b8b43253f..1b2dc7f8e1 100644
--- a/Python/ceval_gil.h
+++ b/Python/ceval_gil.h
@@ -144,11 +144,7 @@ static void
drop_gil(struct _ceval_runtime_state *ceval, struct _ceval_state *ceval2,
PyThreadState *tstate)
{
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- struct _gil_runtime_state *gil = &ceval2->gil;
-#else
struct _gil_runtime_state *gil = &ceval->gil;
-#endif
if (!_Py_atomic_load_relaxed(&gil->locked)) {
Py_FatalError("drop_gil: GIL is not locked");
}
@@ -232,11 +228,7 @@ take_gil(PyThreadState *tstate)
PyInterpreterState *interp = tstate->interp;
struct _ceval_runtime_state *ceval = &interp->runtime->ceval;
struct _ceval_state *ceval2 = &interp->ceval;
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- struct _gil_runtime_state *gil = &ceval2->gil;
-#else
struct _gil_runtime_state *gil = &ceval->gil;
-#endif
/* Check that _PyEval_InitThreads() was called to create the lock */
assert(gil_created(gil));
@@ -328,22 +320,12 @@ _ready:
void _PyEval_SetSwitchInterval(unsigned long microseconds)
{
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- PyInterpreterState *interp = PyInterpreterState_Get();
- struct _gil_runtime_state *gil = &interp->ceval.gil;
-#else
struct _gil_runtime_state *gil = &_PyRuntime.ceval.gil;
-#endif
gil->interval = microseconds;
}
unsigned long _PyEval_GetSwitchInterval()
{
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- PyInterpreterState *interp = PyInterpreterState_Get();
- struct _gil_runtime_state *gil = &interp->ceval.gil;
-#else
struct _gil_runtime_state *gil = &_PyRuntime.ceval.gil;
-#endif
return gil->interval;
}
diff --git a/Python/preconfig.c b/Python/preconfig.c
index afa16cccf3..0deb07a893 100644
--- a/Python/preconfig.c
+++ b/Python/preconfig.c
@@ -294,17 +294,7 @@ _PyPreConfig_InitCompatConfig(PyPreConfig *config)
config->coerce_c_locale_warn = 0;
config->dev_mode = -1;
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- /* bpo-40512: pymalloc is not compatible with subinterpreters,
- force usage of libc malloc() which is thread-safe. */
-#ifdef Py_DEBUG
- config->allocator = PYMEM_ALLOCATOR_MALLOC_DEBUG;
-#else
- config->allocator = PYMEM_ALLOCATOR_MALLOC;
-#endif
-#else
config->allocator = PYMEM_ALLOCATOR_NOT_SET;
-#endif
#ifdef MS_WINDOWS
config->legacy_windows_fs_encoding = -1;
#endif
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 273f6d62b2..960a38aebe 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1986,12 +1986,10 @@ new_interpreter(PyThreadState **tstate_p, int isolated_subinterpreter)
/* Copy the current interpreter config into the new interpreter */
const PyConfig *config;
-#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
if (save_tstate != NULL) {
config = _PyInterpreterState_GetConfig(save_tstate->interp);
}
else
-#endif
{
/* No current thread state, copy from the main interpreter */
PyInterpreterState *main_interp = _PyInterpreterState_Main();
diff --git a/Python/pystate.c b/Python/pystate.c
index 3e28a6ab69..df56c0530f 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -1165,14 +1165,6 @@ _PyThreadState_DeleteExcept(_PyRuntimeState *runtime, PyThreadState *tstate)
}
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
-PyThreadState*
-_PyThreadState_GetTSS(void) {
- return PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey);
-}
-#endif
-
-
PyThreadState *
_PyThreadState_UncheckedGet(void)
{
@@ -1192,11 +1184,7 @@ PyThreadState_Get(void)
PyThreadState *
_PyThreadState_Swap(struct _gilstate_runtime_state *gilstate, PyThreadState *newts)
{
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- PyThreadState *oldts = _PyThreadState_GetTSS();
-#else
PyThreadState *oldts = _PyRuntimeGILState_GetThreadState(gilstate);
-#endif
_PyRuntimeGILState_SetThreadState(gilstate, newts);
/* It should not be possible for more than one thread state
@@ -1215,9 +1203,6 @@ _PyThreadState_Swap(struct _gilstate_runtime_state *gilstate, PyThreadState *new
errno = err;
}
#endif
-#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- PyThread_tss_set(&gilstate->autoTSSkey, newts);
-#endif
return oldts;
}
@@ -1665,9 +1650,7 @@ PyGILState_Ensure(void)
/* Ensure that _PyEval_InitThreads() and _PyGILState_Init() have been
called by Py_Initialize() */
-#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
assert(_PyEval_ThreadsInitialized(runtime));
-#endif
assert(gilstate->autoInterpreterState);
PyThreadState *tcur = (PyThreadState *)PyThread_tss_get(&gilstate->autoTSSkey);
diff --git a/configure b/configure
index b3267025b7..5ee45f320d 100755
--- a/configure
+++ b/configure
@@ -1061,7 +1061,6 @@ with_openssl
with_openssl_rpath
with_ssl_default_suites
with_builtin_hashlib_hashes
-with_experimental_isolated_subinterpreters
enable_test_modules
'
ac_precious_vars='build_alias
@@ -1861,9 +1860,6 @@ Optional Packages:
--with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2
builtin hash modules, md5, sha1, sha256, sha512,
sha3 (with shake), blake2
- --with-experimental-isolated-subinterpreters
- better isolate subinterpreters, experimental build
- mode (default is no)
Some influential environment variables:
PKG_CONFIG path to pkg-config utility
@@ -22475,30 +22471,6 @@ fi
fi
-# --with-experimental-isolated-subinterpreters
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-experimental-isolated-subinterpreters" >&5
-$as_echo_n "checking for --with-experimental-isolated-subinterpreters... " >&6; }
-
-# Check whether --with-experimental-isolated-subinterpreters was given.
-if test "${with_experimental_isolated_subinterpreters+set}" = set; then :
- withval=$with_experimental_isolated_subinterpreters;
-if test "$withval" != no
-then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; };
- $as_echo "#define EXPERIMENTAL_ISOLATED_SUBINTERPRETERS 1" >>confdefs.h
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; };
-fi
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
# Check whether to disable test modules. Once set, setup.py will not build
# test extension modules and "make install" will not install test suites.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --disable-test-modules" >&5
diff --git a/configure.ac b/configure.ac
index 65ec1393e5..91f124aebb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6607,23 +6607,6 @@ AS_VAR_IF([with_builtin_blake2], [yes], [
], [have_libb2=no])
])
-# --with-experimental-isolated-subinterpreters
-AH_TEMPLATE(EXPERIMENTAL_ISOLATED_SUBINTERPRETERS,
- [Better isolate subinterpreters, experimental build mode.])
-AC_MSG_CHECKING(for --with-experimental-isolated-subinterpreters)
-AC_ARG_WITH(experimental-isolated-subinterpreters,
- AS_HELP_STRING([--with-experimental-isolated-subinterpreters],
- [better isolate subinterpreters, experimental build mode (default is no)]),
-[
-if test "$withval" != no
-then
- AC_MSG_RESULT(yes);
- AC_DEFINE(EXPERIMENTAL_ISOLATED_SUBINTERPRETERS)
-else
- AC_MSG_RESULT(no);
-fi],
-[AC_MSG_RESULT(no)])
-
# Check whether to disable test modules. Once set, setup.py will not build
# test extension modules and "make install" will not install test suites.
AC_MSG_CHECKING([for --disable-test-modules])
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 383fd47dd4..b325ef259c 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -44,9 +44,6 @@
/* Define if --enable-ipv6 is specified */
#undef ENABLE_IPV6
-/* Better isolate subinterpreters, experimental build mode. */
-#undef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
-
/* Define to 1 if your system stores words within floats with the most
significant word first */
#undef FLOAT_WORDS_BIGENDIAN