Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
Only initialize bloom_linebreak once in the process.
  • Loading branch information
ericsnowcurrently committed Nov 15, 2022
commit e50ea0757b91ff7e1537599683b1324899fcc5dd
17 changes: 14 additions & 3 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -14491,12 +14491,14 @@ PyTypeObject PyUnicode_Type = {

/* Initialize the Unicode implementation */

void
_PyUnicode_InitState(PyInterpreterState *interp)
static void
_init_global_state(void)
{
if (!_Py_IsMainInterpreter(interp)) {
static int initialized = 0;
if (initialized) {
return;
}
initialized = 1;

/* initialize the linebreak bloom filter */
const Py_UCS2 linebreak[] = {
Expand All @@ -14514,6 +14516,15 @@ _PyUnicode_InitState(PyInterpreterState *interp)
Py_ARRAY_LENGTH(linebreak));
}

void
_PyUnicode_InitState(PyInterpreterState *interp)
{
if (!_Py_IsMainInterpreter(interp)) {
return;
}
_init_global_state();
}


PyStatus
_PyUnicode_InitGlobalObjects(PyInterpreterState *interp)
Expand Down
5 changes: 2 additions & 3 deletions Tools/c-analyzer/cpython/ignored.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Python/fileutils.c set_inheritable ioctl_works -
Objects/longobject.c long_from_non_binary_base log_base_BASE -
Objects/longobject.c long_from_non_binary_base convwidth_base -
Objects/longobject.c long_from_non_binary_base convmultmax_base -
Objects/unicodeobject.c - bloom_linebreak -
Objects/unicodeobject.c _init_global_state initialized -

# XXX Move to _PyRuntimeState?
Parser/action_helpers.c _PyPegen_dummy_name cache -
Expand Down Expand Up @@ -112,9 +114,6 @@ Python/frozen.c - PyImport_FrozenModules -
Python/import.c - inittab_copy -
Python/import.c - PyImport_Inittab -

# initialized during init
Objects/unicodeobject.c - bloom_linebreak -

# used temporarily during init
Python/sysmodule.c - _preinit_warnoptions -
Python/sysmodule.c - _preinit_xoptions -
Expand Down