@@ -10,15 +10,12 @@ extern "C" {
1010
1111#include "pycore_fileutils.h" // _Py_error_handler
1212#include "pycore_ucnhash.h" // _PyUnicode_Name_CAPI
13+ #include "pycore_global_objects.h" // _Py_INTERP_CACHED_OBJECT
1314
1415
1516// Maximum code point of Unicode 6.0: 0x10ffff (1,114,111).
1617#define _Py_MAX_UNICODE 0x10ffff
1718
18- /* This hashtable holds statically allocated interned strings.
19- * See InternalDocs/string_interning.md for details.
20- */
21- #define INTERNED_STRINGS _PyRuntime.cached_objects.interned_strings
2219
2320extern int _PyUnicode_IsModifiable (PyObject * unicode );
2421extern void _PyUnicodeWriter_InitWithBuffer (
@@ -362,6 +359,19 @@ extern PyTypeObject _PyUnicodeASCIIIter_Type;
362359
363360// All these are "ref-neutral", like the public PyUnicode_InternInPlace.
364361
362+ /* This hashtable holds statically allocated interned strings.
363+ * See InternalDocs/string_interning.md for details.
364+ */
365+ #define INTERNED_STRINGS _PyRuntime.cached_objects.interned_strings
366+
367+ /* This dictionary holds per-interpreter interned strings.
368+ * See InternalDocs/string_interning.md for details.
369+ */
370+ static inline PyObject * get_interned_dict (PyInterpreterState * interp )
371+ {
372+ return _Py_INTERP_CACHED_OBJECT (interp , interned_strings );
373+ }
374+
365375// Explicit interning routines:
366376PyAPI_FUNC (void ) _PyUnicode_InternMortal (PyInterpreterState * interp , PyObject * * );
367377PyAPI_FUNC (void ) _PyUnicode_InternImmortal (PyInterpreterState * interp , PyObject * * );
0 commit comments