Skip to content

Commit 970c10b

Browse files
committed
refactor
1 parent bc6f8f2 commit 970c10b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Objects/bytesobject.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,20 +2872,18 @@ _PyBytes_FromSequence_lock_held(PyObject *x)
28722872
}
28732873
Py_ssize_t value = PyNumber_AsSsize_t(items[i], NULL);
28742874
if (value == -1 && PyErr_Occurred()) {
2875-
goto error;
2875+
Py_DECREF(bytes);
2876+
return NULL
28762877
}
28772878
if (value < 0 || value >= 256) {
28782879
PyErr_SetString(PyExc_ValueError,
28792880
"bytes must be in range(0, 256)");
2880-
goto error;
2881+
Py_DECREF(bytes);
2882+
return NULL
28812883
}
28822884
*str++ = (char) value;
28832885
}
28842886
return bytes;
2885-
2886-
error:
2887-
Py_DECREF(bytes);
2888-
return NULL;
28892887
}
28902888

28912889
static PyObject *

0 commit comments

Comments
 (0)