PEP 7: add {...} around null_error() in abstract.c
Issue #27128.
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 9e9c9aa..cec47bf 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -32,8 +32,10 @@
{
PyObject *v;
- if (o == NULL)
+ if (o == NULL) {
return null_error();
+ }
+
v = (PyObject *)o->ob_type;
Py_INCREF(v);
return v;
@@ -137,8 +139,9 @@
{
PyMappingMethods *m;
- if (o == NULL || key == NULL)
+ if (o == NULL || key == NULL) {
return null_error();
+ }
m = o->ob_type->tp_as_mapping;
if (m && m->mp_subscript) {
@@ -1125,8 +1128,10 @@
{
PyNumberMethods *m;
- if (o == NULL)
+ if (o == NULL) {
return null_error();
+ }
+
m = o->ob_type->tp_as_number;
if (m && m->nb_negative)
return (*m->nb_negative)(o);
@@ -1139,8 +1144,10 @@
{
PyNumberMethods *m;
- if (o == NULL)
+ if (o == NULL) {
return null_error();
+ }
+
m = o->ob_type->tp_as_number;
if (m && m->nb_positive)
return (*m->nb_positive)(o);
@@ -1153,8 +1160,10 @@
{
PyNumberMethods *m;
- if (o == NULL)
+ if (o == NULL) {
return null_error();
+ }
+
m = o->ob_type->tp_as_number;
if (m && m->nb_invert)
return (*m->nb_invert)(o);
@@ -1167,8 +1176,10 @@
{
PyNumberMethods *m;
- if (o == NULL)
+ if (o == NULL) {
return null_error();
+ }
+
m = o->ob_type->tp_as_number;
if (m && m->nb_absolute)
return m->nb_absolute(o);
@@ -1184,8 +1195,10 @@
PyNumber_Index(PyObject *item)
{
PyObject *result = NULL;
- if (item == NULL)
+ if (item == NULL) {
return null_error();
+ }
+
if (PyLong_Check(item)) {
Py_INCREF(item);
return item;
@@ -1273,8 +1286,10 @@
Py_buffer view;
_Py_IDENTIFIER(__trunc__);
- if (o == NULL)
+ if (o == NULL) {
return null_error();
+ }
+
if (PyLong_CheckExact(o)) {
Py_INCREF(o);
return o;
@@ -1349,8 +1364,10 @@
{
PyNumberMethods *m;
- if (o == NULL)
+ if (o == NULL) {
return null_error();
+ }
+
if (PyFloat_CheckExact(o)) {
Py_INCREF(o);
return o;
@@ -1451,8 +1468,9 @@
{
PySequenceMethods *m;
- if (s == NULL || o == NULL)
+ if (s == NULL || o == NULL) {
return null_error();
+ }
m = s->ob_type->tp_as_sequence;
if (m && m->sq_concat)
@@ -1475,8 +1493,9 @@
{
PySequenceMethods *m;
- if (o == NULL)
+ if (o == NULL) {
return null_error();
+ }
m = o->ob_type->tp_as_sequence;
if (m && m->sq_repeat)
@@ -1504,8 +1523,9 @@
{
PySequenceMethods *m;
- if (s == NULL || o == NULL)
+ if (s == NULL || o == NULL) {
return null_error();
+ }
m = s->ob_type->tp_as_sequence;
if (m && m->sq_inplace_concat)
@@ -1528,8 +1548,9 @@
{
PySequenceMethods *m;
- if (o == NULL)
+ if (o == NULL) {
return null_error();
+ }
m = o->ob_type->tp_as_sequence;
if (m && m->sq_inplace_repeat)
@@ -1557,8 +1578,9 @@
{
PySequenceMethods *m;
- if (s == NULL)
+ if (s == NULL) {
return null_error();
+ }
m = s->ob_type->tp_as_sequence;
if (m && m->sq_item) {
@@ -1583,7 +1605,9 @@
{
PyMappingMethods *mp;
- if (!s) return null_error();
+ if (!s) {
+ return null_error();
+ }
mp = s->ob_type->tp_as_mapping;
if (mp && mp->mp_subscript) {
@@ -1710,8 +1734,9 @@
PyObject *result = NULL;
Py_ssize_t j;
- if (v == NULL)
+ if (v == NULL) {
return null_error();
+ }
/* Special-case the common tuple and list cases, for efficiency. */
if (PyTuple_CheckExact(v)) {
@@ -1791,8 +1816,9 @@
PyObject *result; /* result list */
PyObject *rv; /* return value from PyList_Extend */
- if (v == NULL)
+ if (v == NULL) {
return null_error();
+ }
result = PyList_New(0);
if (result == NULL)
@@ -1812,8 +1838,9 @@
{
PyObject *it;
- if (v == NULL)
+ if (v == NULL) {
return null_error();
+ }
if (PyList_CheckExact(v) || PyTuple_CheckExact(v)) {
Py_INCREF(v);
@@ -1996,8 +2023,9 @@
{
PyObject *okey, *r;
- if (key == NULL)
+ if (key == NULL) {
return null_error();
+ }
okey = PyUnicode_FromString(key);
if (okey == NULL)
@@ -2292,8 +2320,9 @@
va_list va;
PyObject *args, *result;
- if (callable == NULL)
+ if (callable == NULL) {
return null_error();
+ }
if (format && *format) {
va_start(va, format);
@@ -2318,8 +2347,9 @@
va_list va;
PyObject *args, *result;
- if (callable == NULL)
+ if (callable == NULL) {
return null_error();
+ }
if (format && *format) {
va_start(va, format);
@@ -2375,8 +2405,9 @@
PyObject *func = NULL;
PyObject *retval = NULL;
- if (o == NULL || name == NULL)
+ if (o == NULL || name == NULL) {
return null_error();
+ }
func = PyObject_GetAttrString(o, name);
if (func == NULL)
@@ -2397,8 +2428,9 @@
PyObject *func = NULL;
PyObject *retval = NULL;
- if (o == NULL || name == NULL)
+ if (o == NULL || name == NULL) {
return null_error();
+ }
func = _PyObject_GetAttrId(o, name);
if (func == NULL)
@@ -2419,8 +2451,9 @@
PyObject *func = NULL;
PyObject *retval;
- if (o == NULL || name == NULL)
+ if (o == NULL || name == NULL) {
return null_error();
+ }
func = PyObject_GetAttrString(o, name);
if (func == NULL)
@@ -2440,8 +2473,9 @@
PyObject *func = NULL;
PyObject *retval;
- if (o == NULL || name == NULL)
+ if (o == NULL || name == NULL) {
return null_error();
+ }
func = _PyObject_GetAttrId(o, name);
if (func == NULL) {
@@ -2482,8 +2516,9 @@
PyObject *args, *tmp;
va_list vargs;
- if (callable == NULL || name == NULL)
+ if (callable == NULL || name == NULL) {
return null_error();
+ }
callable = PyObject_GetAttr(callable, name);
if (callable == NULL)
@@ -2511,8 +2546,9 @@
PyObject *args, *tmp;
va_list vargs;
- if (callable == NULL || name == NULL)
+ if (callable == NULL || name == NULL) {
return null_error();
+ }
callable = _PyObject_GetAttrId(callable, name);
if (callable == NULL)
@@ -2539,8 +2575,9 @@
PyObject *args, *tmp;
va_list vargs;
- if (callable == NULL)
+ if (callable == NULL) {
return null_error();
+ }
/* count the args */
va_start(vargs, callable);