diff options
author | Charlie Zhao <zhaoyu_hit@qq.com> | 2023-10-06 23:15:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-06 23:15:19 (GMT) |
commit | de1052245f67d5c5a5dbb4f39449f7687f58fd78 (patch) | |
tree | f94ed9ee518dcc8eb5ebfa9f78d99a049bdb988d /Modules | |
parent | 5fd8821cf8eb1fe2e8575f8c7cc747cf78855a88 (diff) | |
download | cpython-de1052245f67d5c5a5dbb4f39449f7687f58fd78.zip cpython-de1052245f67d5c5a5dbb4f39449f7687f58fd78.tar.gz cpython-de1052245f67d5c5a5dbb4f39449f7687f58fd78.tar.bz2 |
gh-106078: Suppress the warning caused by multi-phase initialization of `decimal` (#107524)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_decimal/_decimal.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index b49ea3c..99ff9aa 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -5877,6 +5877,7 @@ error: return NULL; } +static int minalloc_is_set = 0; static int _decimal_exec(PyObject *m) @@ -5899,7 +5900,12 @@ _decimal_exec(PyObject *m) mpd_reallocfunc = PyMem_Realloc; mpd_callocfunc = mpd_callocfunc_em; mpd_free = PyMem_Free; - mpd_setminalloc(_Py_DEC_MINALLOC); + + /* Suppress the warning caused by multi-phase initialization */ + if (!minalloc_is_set) { + mpd_setminalloc(_Py_DEC_MINALLOC); + minalloc_is_set = 1; + } decimal_state *state = get_module_state(m); |