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
Add constructor attribute
  • Loading branch information
CharlieZhao95 committed Aug 1, 2023
commit 20ea76e9b693a76fb80fa8024781d68e2b5b3103
13 changes: 6 additions & 7 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -5877,6 +5877,12 @@ cfunc_noargs(PyTypeObject *t, const char *name)
}


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

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

/* Suppress the warning caused by multi-phase initialization */
static int minalloc_is_set = 0;
if (minalloc_is_set) {
mpd_setminalloc(_Py_DEC_MINALLOC);
minalloc_is_set = 1;
}

decimal_state *state = get_module_state(m);

/* Init external C-API functions */
Expand Down
1 change: 0 additions & 1 deletion Tools/c-analyzer/cpython/ignored.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ Modules/_decimal/_decimal.c - invalid_signals_err -
Modules/_decimal/_decimal.c - signal_map_template -
Modules/_decimal/_decimal.c - ssize_constants -
Modules/_decimal/_decimal.c - INVALID_SIGNALDICT_ERROR_MSG -
Modules/_decimal/_decimal.c - minalloc_is_set -
Modules/_elementtree.c - ExpatMemoryHandler -
Modules/_hashopenssl.c - py_hashes -
Modules/_hacl/Hacl_Hash_SHA1.c - _h0 -
Expand Down