Skip to content

Commit 9fab4f3

Browse files
Apply batched suggestions from code review
Co-authored-by: Kyle Stanley <aeros167@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent fe71ad6 commit 9fab4f3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Modules/_json.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,10 @@ encoder_listencode_dict(PyEncoderObject *s, _PyAccu *acc,
15741574
if (items == NULL)
15751575
goto bail;
15761576

1577-
coerced_items = PyList_New(0);
1577+
coerced_items = PyList_New(0);
1578+
if (coerced_items == NULL) {
1579+
goto bail;
1580+
}
15781581
it = PyObject_GetIter(items);
15791582
Py_DECREF(items);
15801583
if (it == NULL)
@@ -1598,7 +1601,7 @@ encoder_listencode_dict(PyEncoderObject *s, _PyAccu *acc,
15981601
}
15991602
else if (key == Py_True || key == Py_False || key == Py_None) {
16001603
/* This must come before the PyLong_Check because
1601-
True and False are also 1 and 0.*/
1604+
True and False are also 1 and 0.*/
16021605
kstr = _encoded_const(key);
16031606
if (kstr == NULL)
16041607
goto bail;

0 commit comments

Comments
 (0)