diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2022-05-27 23:38:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-27 23:38:01 (GMT) |
commit | caa279d6fd5f151e57f891cd4f6ba51b532501c6 (patch) | |
tree | c19c87efdefab0b4e4a5291896cfb86e37ec90f2 /Objects | |
parent | e6a57678cafe18ca132ee9510252168fcc392a8d (diff) | |
download | cpython-caa279d6fd5f151e57f891cd4f6ba51b532501c6.zip cpython-caa279d6fd5f151e57f891cd4f6ba51b532501c6.tar.gz cpython-caa279d6fd5f151e57f891cd4f6ba51b532501c6.tar.bz2 |
bpo-40514: Drop EXPERIMENTAL_ISOLATED_SUBINTERPRETERS (gh-93185)
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
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 25 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 17 |
2 files changed, 3 insertions, 39 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 37ac886..2566d21 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); @@ -4027,7 +4022,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)) { @@ -4037,7 +4032,6 @@ type_setattro(PyTypeObject *type, PyObject *name, PyObject *value) return -1; } } -#endif } else { /* Will fail in _PyObject_GenericSetAttrWithDict. */ @@ -8474,17 +8468,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(); @@ -8509,24 +8497,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 f712fbf..d0e4bcd 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -190,11 +190,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 @@ -203,9 +198,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 @@ -1530,7 +1523,6 @@ unicode_dealloc(PyObject *unicode) } #endif -#ifdef INTERNED_STRINGS if (PyUnicode_CHECK_INTERNED(unicode)) { /* Revive the dead object temporarily. PyDict_DelItem() removes two references (key and value) which were ignored by @@ -1546,7 +1538,6 @@ unicode_dealloc(PyObject *unicode) assert(Py_REFCNT(unicode) == 1); Py_SET_REFCNT(unicode, 0); } -#endif if (_PyUnicode_HAS_UTF8_MEMORY(unicode)) { PyObject_Free(_PyUnicode_UTF8(unicode)); @@ -10568,13 +10559,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); } @@ -14645,7 +14634,6 @@ PyUnicode_InternInPlace(PyObject **p) return; } -#ifdef INTERNED_STRINGS if (interned == NULL) { interned = PyDict_New(); if (interned == NULL) { @@ -14671,11 +14659,6 @@ PyUnicode_InternInPlace(PyObject **p) this. */ Py_SET_REFCNT(s, Py_REFCNT(s) - 2); _PyUnicode_STATE(s).interned = 1; -#else - // PyDict expects that interned strings have their hash - // (PyASCIIObject.hash) already computed. - (void)unicode_hash(s); -#endif } // Function kept for the stable ABI. |