Skip to content

Commit 9dc1258

Browse files
committed
Revert "PEP 7 + Py_IsNone macro in functions touched"
This reverts commit 2a9cdd5.
1 parent 2a9cdd5 commit 9dc1258

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

Modules/_json.c

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,8 @@ _parse_array_unicode(PyScannerObject *s, PyObject *memo, PyObject *pystr, Py_ssi
946946
goto bail;
947947
}
948948
*next_idx_ptr = idx + 1;
949-
/* if array_hook is not None: return array_hook(rval) */
950-
if (!Py_IsNone(s->array_hook)) {
949+
/* if array_hook is not None: rval = array_hook(rval) */
950+
if (s->array_hook != Py_None) {
951951
val = PyObject_CallOneArg(s->array_hook, rval);
952952
Py_DECREF(rval);
953953
return val;
@@ -1247,9 +1247,8 @@ scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
12471247
PyObject *strict;
12481248
static char *kwlist[] = {"context", NULL};
12491249

1250-
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:make_scanner", kwlist, &ctx)) {
1250+
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:make_scanner", kwlist, &ctx))
12511251
return NULL;
1252-
}
12531252

12541253
s = (PyScannerObject *)type->tp_alloc(type, 0);
12551254
if (s == NULL) {
@@ -1258,38 +1257,30 @@ scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
12581257

12591258
/* All of these will fail "gracefully" so we don't need to verify them */
12601259
strict = PyObject_GetAttrString(ctx, "strict");
1261-
if (strict == NULL) {
1260+
if (strict == NULL)
12621261
goto bail;
1263-
}
12641262
s->strict = PyObject_IsTrue(strict);
12651263
Py_DECREF(strict);
1266-
if (s->strict < 0) {
1264+
if (s->strict < 0)
12671265
goto bail;
1268-
}
12691266
s->object_hook = PyObject_GetAttrString(ctx, "object_hook");
1270-
if (s->object_hook == NULL) {
1267+
if (s->object_hook == NULL)
12711268
goto bail;
1272-
}
12731269
s->object_pairs_hook = PyObject_GetAttrString(ctx, "object_pairs_hook");
1274-
if (s->object_pairs_hook == NULL) {
1270+
if (s->object_pairs_hook == NULL)
12751271
goto bail;
1276-
}
12771272
s->array_hook = PyObject_GetAttrString(ctx, "array_hook");
1278-
if (s->array_hook == NULL) {
1273+
if (s->array_hook == NULL)
12791274
goto bail;
1280-
}
12811275
s->parse_float = PyObject_GetAttrString(ctx, "parse_float");
1282-
if (s->parse_float == NULL) {
1276+
if (s->parse_float == NULL)
12831277
goto bail;
1284-
}
12851278
s->parse_int = PyObject_GetAttrString(ctx, "parse_int");
1286-
if (s->parse_int == NULL) {
1279+
if (s->parse_int == NULL)
12871280
goto bail;
1288-
}
12891281
s->parse_constant = PyObject_GetAttrString(ctx, "parse_constant");
1290-
if (s->parse_constant == NULL) {
1282+
if (s->parse_constant == NULL)
12911283
goto bail;
1292-
}
12931284

12941285
return (PyObject *)s;
12951286

0 commit comments

Comments
 (0)