Skip to content

Commit 1df49ee

Browse files
move dicts of interned strings to appropriate section in header
1 parent 8863b2e commit 1df49ee

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

Include/internal/pycore_unicodeobject.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

2320
extern int _PyUnicode_IsModifiable(PyObject *unicode);
2421
extern 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:
366376
PyAPI_FUNC(void) _PyUnicode_InternMortal(PyInterpreterState *interp, PyObject **);
367377
PyAPI_FUNC(void) _PyUnicode_InternImmortal(PyInterpreterState *interp, PyObject **);

0 commit comments

Comments
 (0)