summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-05-28 00:56:30 (GMT)
committerGitHub <noreply@github.com>2022-05-28 00:56:30 (GMT)
commit36374251aa39c0a89be277fb76439bacc709f8b7 (patch)
treea3bba5dee5d355f132201b514ba73ebe01838a16 /Objects
parentcf63b80bc482ef971ecb6d3ed9a1dc4a93d73744 (diff)
downloadcpython-36374251aa39c0a89be277fb76439bacc709f8b7.zip
cpython-36374251aa39c0a89be277fb76439bacc709f8b7.tar.gz
cpython-36374251aa39c0a89be277fb76439bacc709f8b7.tar.bz2
[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
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c25
-rw-r--r--Objects/unicodeobject.c18
2 files changed, 3 insertions, 40 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 1bcfd9a..c1bae0b 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 656c7cc..a7bd961 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