summaryrefslogtreecommitdiffstats
path: root/Include/cpython/unicodeobject.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-05-13 11:40:22 (GMT)
committerGitHub <noreply@github.com>2022-05-13 11:40:22 (GMT)
commit059b5baf98c9503d9d59c79fba117826caa5a3e1 (patch)
tree65c3379d48280ccdea4e6b4f8adcb103065905a4 /Include/cpython/unicodeobject.h
parentf62ad4f2c4214fdc05cc45c27a5c068553c7942c (diff)
downloadcpython-059b5baf98c9503d9d59c79fba117826caa5a3e1.zip
cpython-059b5baf98c9503d9d59c79fba117826caa5a3e1.tar.gz
cpython-059b5baf98c9503d9d59c79fba117826caa5a3e1.tar.bz2
gh-85858: Remove PyUnicode_InternImmortal() function (#92579)
Remove the PyUnicode_InternImmortal() function and the SSTATE_INTERNED_IMMORTAL macro. The PyUnicode_InternImmortal() function is still exported in the stable ABI. The function is removed from the API. PyASCIIObject.state.interned size is now a single bit, rather than 2 bits. Keep SSTATE_NOT_INTERNED and SSTATE_INTERNED_MORTAL macros for backward compatibility, but no longer use them internally since the interned member is now a single bit and so can only have two values (interned or not interned). Update stats of _PyUnicode_ClearInterned().
Diffstat (limited to 'Include/cpython/unicodeobject.h')
-rw-r--r--Include/cpython/unicodeobject.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/Include/cpython/unicodeobject.h b/Include/cpython/unicodeobject.h
index 16db2cb..37bb13c 100644
--- a/Include/cpython/unicodeobject.h
+++ b/Include/cpython/unicodeobject.h
@@ -98,15 +98,9 @@ typedef struct {
Py_ssize_t length; /* Number of code points in the string */
Py_hash_t hash; /* Hash value; -1 if not set */
struct {
- /*
- SSTATE_NOT_INTERNED (0)
- SSTATE_INTERNED_MORTAL (1)
- SSTATE_INTERNED_IMMORTAL (2)
-
- If interned != SSTATE_NOT_INTERNED, the two references from the
- dictionary to this object are *not* counted in ob_refcnt.
- */
- unsigned int interned:2;
+ /* If interned is set, the two references from the
+ dictionary to this object are *not* counted in ob_refcnt. */
+ unsigned int interned:1;
/* Character size:
- PyUnicode_1BYTE_KIND (1):
@@ -189,7 +183,6 @@ PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
/* Interning state. */
#define SSTATE_NOT_INTERNED 0
#define SSTATE_INTERNED_MORTAL 1
-#define SSTATE_INTERNED_IMMORTAL 2
/* Use only if you know it's a string */
static inline unsigned int PyUnicode_CHECK_INTERNED(PyObject *op) {