Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit de10522

Browse filesBrowse files
gh-106078: Suppress the warning caused by multi-phase initialization of decimal (#107524)
1 parent 5fd8821 commit de10522
Copy full SHA for de10522

File tree

Expand file treeCollapse file tree

2 files changed

+10
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-1
lines changed

‎Modules/_decimal/_decimal.c

Copy file name to clipboardExpand all lines: Modules/_decimal/_decimal.c
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5877,6 +5877,7 @@ cfunc_noargs(PyTypeObject *t, const char *name)
58775877
return NULL;
58785878
}
58795879

5880+
static int minalloc_is_set = 0;
58805881

58815882
static int
58825883
_decimal_exec(PyObject *m)
@@ -5899,7 +5900,12 @@ _decimal_exec(PyObject *m)
58995900
mpd_reallocfunc = PyMem_Realloc;
59005901
mpd_callocfunc = mpd_callocfunc_em;
59015902
mpd_free = PyMem_Free;
5902-
mpd_setminalloc(_Py_DEC_MINALLOC);
5903+
5904+
/* Suppress the warning caused by multi-phase initialization */
5905+
if (!minalloc_is_set) {
5906+
mpd_setminalloc(_Py_DEC_MINALLOC);
5907+
minalloc_is_set = 1;
5908+
}
59035909

59045910
decimal_state *state = get_module_state(m);
59055911

‎Tools/c-analyzer/cpython/ignored.tsv

Copy file name to clipboardExpand all lines: Tools/c-analyzer/cpython/ignored.tsv
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ Python/pylifecycle.c fatal_error reentrant -
166166
# explicitly protected, internal-only
167167
Modules/_xxinterpchannelsmodule.c - _globals -
168168

169+
# set once during module init
170+
Modules/_decimal/_decimal.c - minalloc_is_set -
171+
169172

170173
##################################
171174
## not significant

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.