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
Move minalloc_is_set outside
  • Loading branch information
CharlieZhao95 committed Aug 1, 2023
commit ed8a2b3a1714cc7ee407c10b7eed2fb2f0814b2b
13 changes: 7 additions & 6 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -5876,12 +5876,7 @@ cfunc_noargs(PyTypeObject *t, const char *name)
return NULL;
}


/* Suppress the warning caused by multi-phase initialization */
__attribute__((constructor)) void minalloc_init(void)
{
mpd_setminalloc(_Py_DEC_MINALLOC);
}
static int minalloc_is_set = 0;

static int
_decimal_exec(PyObject *m)
Expand All @@ -5905,6 +5900,12 @@ _decimal_exec(PyObject *m)
mpd_callocfunc = mpd_callocfunc_em;
mpd_free = PyMem_Free;

/* Suppress the warning caused by multi-phase initialization */
if (minalloc_is_set) {
Comment thread
Eclips4 marked this conversation as resolved.
Outdated
mpd_setminalloc(_Py_DEC_MINALLOC);
minalloc_is_set = 1;
}

decimal_state *state = get_module_state(m);

/* Init external C-API functions */
Expand Down
3 changes: 3 additions & 0 deletions Tools/c-analyzer/cpython/ignored.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ Python/pylifecycle.c fatal_error reentrant -
# explicitly protected, internal-only
Modules/_xxinterpchannelsmodule.c - _globals -

# set once during module init
Modules/_decimal/_decimal.c - minalloc_is_set -


##################################
## not significant
Expand Down