cpython/Include/cpython
Eric Snow 4f71f1680d
[3.12] gh-106931: Intern Statically Allocated Strings Globally (gh-107272) (gh-110713)
We tried this before with a dict and for all interned strings.  That ran into problems due to interpreter isolation.  However, exclusively using a per-interpreter cache caused some inconsistency that can eliminate the benefit of interning.  Here we circle back to using a global cache, but only for statically allocated strings.  We also use a more-basic _Py_hashtable_t for that global cache instead of a dict.

Ideally we would only have the global cache, but the optional isolation of each interpreter's allocator means that a non-static string object must not outlive its interpreter.  Thus we would have to store a copy of each such interned string in the global cache, tied to the main interpreter.

(cherry-picked from commit b72947a8d2)
2023-11-27 23:51:12 +00:00
..
abstract.h gh-98586: Add vector call APIs to the Limited API (GH-98587) 2022-10-27 11:45:42 +02:00
bytearrayobject.h
bytesobject.h
cellobject.h
ceval.h [3.12] gh-104812: Run Pending Calls in any Thread (gh-104813) (gh-105752) 2023-06-14 00:50:08 +00:00
classobject.h gh-89653: PEP 670: Convert macros to functions (#99843) 2022-11-28 16:40:08 +01:00
code.h [3.12] GH-108390: Prevent non-local events being set with sys.monitoring.set_local_events() (GH-108420) (#108899) 2023-09-05 11:29:38 +00:00
compile.h gh-98811: use full source location to simplify __future__ imports error checking. This also fixes an incorrect error offset. (GH-98812) 2022-10-31 13:08:03 +00:00
complexobject.h
context.h
descrobject.h
dictobject.h gh-102381: don't call watcher callback with dead object (#102382) 2023-03-07 17:10:58 -07:00
fileobject.h gh-96670: Raise SyntaxError when parsing NULL bytes (#97594) 2022-09-27 23:23:42 +01:00
fileutils.h
floatobject.h gh-89653: PEP 670: Convert macros to functions (#99843) 2022-11-28 16:40:08 +01:00
frameobject.h [3.12] GH-96803: Move PyUnstable_InterpreterFrame_GetCode() to Python.h (GH-107188) (#107195) 2023-07-24 19:54:42 +00:00
funcobject.h gh-103763: Implement PEP 695 (#103764) 2023-05-15 20:36:23 -07:00
genobject.h GH-102181: Improve specialization stats for SEND (GH-102182) 2023-05-10 22:40:59 +00:00
import.h gh-100227: Isolate the Import State to Each Interpreter (gh-101941) 2023-03-09 09:46:21 -07:00
initconfig.h [3.12] gh-98608: Move PyInterpreterConfig to pylifecycle.h (GH-107191) (#107198) 2023-07-24 20:13:07 +00:00
interpreteridobject.h [3.12] gh-101524: Only Use Public C-API in the _xxsubinterpreters Module (gh-105258) (gh-107303) 2023-07-27 13:15:47 -06:00
listobject.h gh-87347: Add parenthesis around macro arguments (#93915) 2022-06-20 16:04:52 +02:00
longintrepr.h [3.12] GH-101291: Avoid using macros with casts in low-level long API. (GH-104742) (#104759) 2023-05-23 09:28:04 +00:00
longobject.h GH-101291: Add low level, unstable API for pylong (GH-101685) 2023-05-21 14:45:48 +01:00
memoryobject.h gh-104223: Fix issues with inheriting from buffer classes (#104227) 2023-05-08 09:52:41 -07:00
methodobject.h
modsupport.h [3.12] gh-86493: Fix possible leaks in some modules initialization (GH-106768) (GH-106855) 2023-07-18 15:14:10 +03:00
object.h [3.12] gh-91051: fix segfault when using all 8 type watchers (GH-107853) (#107876) 2023-08-16 11:58:54 +02:00
objimpl.h gh-103743: Add PyUnstable_Object_GC_NewWithExtraData (GH-103744) 2023-05-02 13:38:46 +02:00
odictobject.h gh-87347: Add parenthesis around macro arguments (#93915) 2022-06-20 16:04:52 +02:00
picklebufobject.h
pthread_stubs.h gh-95174: Add pthread stubs for WASI (GH-95234) 2022-07-27 20:28:06 +02:00
pyctype.h
pydebug.h
pyerrors.h [3.12] gh-105071: add PyUnstable_Exc_PrepReraiseStar to expose except* implementation in the unstable API (GH-105072) (#105095) 2023-05-30 16:50:23 +01:00
pyfpe.h
pyframe.h [3.12] GH-96803: Move PyUnstable_InterpreterFrame_GetCode() to Python.h (GH-107188) (#107195) 2023-07-24 19:54:42 +00:00
pylifecycle.h [3.12] gh-98608: Move PyInterpreterConfig to pylifecycle.h (GH-107191) (#107198) 2023-07-24 20:13:07 +00:00
pymem.h
pystate.h [3.12] GH-107263: Increase C stack limit for most functions, except _PyEval_EvalFrameDefault() (GH-107535) (#107618) 2023-08-04 12:25:51 +02:00
pythonrun.h gh-87347: Add parenthesis around macro arguments (#93915) 2022-06-20 16:04:52 +02:00
pythread.h gh-95174: Add pthread stubs for WASI (GH-95234) 2022-07-27 20:28:06 +02:00
pytime.h gh-77532: Minor tweaks to allow compiling with PlatformToolset=ClangCL on Windows (GH-101352) 2023-01-27 14:45:08 +00:00
setobject.h gh-89653: PEP 670: Convert macros to functions (#99843) 2022-11-28 16:40:08 +01:00
sysmodule.h
traceback.h
tupleobject.h gh-87347: Add parenthesis around macro arguments (#93915) 2022-06-20 16:04:52 +02:00
unicodeobject.h [3.12] gh-106931: Intern Statically Allocated Strings Globally (gh-107272) (gh-110713) 2023-11-27 23:51:12 +00:00
warnings.h gh-87347: Add parenthesis around macro arguments (#93915) 2022-06-20 16:04:52 +02:00
weakrefobject.h