Commit 3238a3e3 authored by Georg Brandl's avatar Georg Brandl

Backport part of r65043.

parent 3e75846c
......@@ -55,10 +55,9 @@ _getbytevalue(PyObject* arg, int *value)
face_value = PyLong_AsLong(index);
Py_DECREF(index);
}
if (face_value == -1 && PyErr_Occurred())
return 0;
if (face_value < 0 || face_value >= 256) {
/* this includes the OverflowError in case the long is too large */
PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)");
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment