Skip to content

Commit 669429f

Browse files
miss-islingtonAlexey Izbyshev
authored andcommitted
bpo-34649: Add missing NULL checks to _encoded_const() (GH-9225)
Reported by Svace static analyzer. (cherry picked from commit 6f82bff) Co-authored-by: Alexey Izbyshev <[email protected]>
1 parent b36567b commit 669429f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/_json.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,23 +1893,23 @@ _encoded_const(PyObject *obj)
18931893
if (s_null == NULL) {
18941894
s_null = PyString_InternFromString("null");
18951895
}
1896-
Py_INCREF(s_null);
1896+
Py_XINCREF(s_null);
18971897
return s_null;
18981898
}
18991899
else if (obj == Py_True) {
19001900
static PyObject *s_true = NULL;
19011901
if (s_true == NULL) {
19021902
s_true = PyString_InternFromString("true");
19031903
}
1904-
Py_INCREF(s_true);
1904+
Py_XINCREF(s_true);
19051905
return s_true;
19061906
}
19071907
else if (obj == Py_False) {
19081908
static PyObject *s_false = NULL;
19091909
if (s_false == NULL) {
19101910
s_false = PyString_InternFromString("false");
19111911
}
1912-
Py_INCREF(s_false);
1912+
Py_XINCREF(s_false);
19131913
return s_false;
19141914
}
19151915
else {

0 commit comments

Comments
 (0)