Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adjust internal docs for 3.12
  • Loading branch information
encukou committed Aug 16, 2024
commit cf6a27d0fe4302bae423d9d4e2ffc34dcf48608d
2 changes: 1 addition & 1 deletion Include/internal/pycore_unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PyAPI_FUNC(void) _PyUnicode_InternMortal(PyInterpreterState *interp, PyObject **
PyAPI_FUNC(void) _PyUnicode_InternImmortal(PyInterpreterState *interp, PyObject **);
// Left here to help backporting:
PyAPI_FUNC(void) _PyUnicode_InternInPlace(PyInterpreterState *interp, PyObject **p);
// Only for singletons in the _PyRuntime struct:
// Only for statically allocated strings:
extern void _PyUnicode_InternStatic(PyInterpreterState *interp, PyObject **);

/* other API */
Expand Down
6 changes: 5 additions & 1 deletion InternalDocs/string_interning.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ for declaration, initialization and finalization.

The empty string is one of the singletons: `_Py_STR(empty)`.

The three sets of singletons (`_Py_LATIN1_CHR`, `_Py_ID`, `_Py_STR`)
Deep-frozen modules (see `Tools/build/deepfreeze.py`) use either singletons,
or statically allocated strings. These are added to `INTERNED_STRINGS`
at runtime initialization, when deepfreeze modules are loaded.

These sets of singletons (`_Py_LATIN1_CHR`, `_Py_ID`, `_Py_STR`, deepfreeze)
are disjoint.
If you have such a singleton, it (and no other copy) will be interned.

Expand Down