Kaydet (Commit) f54d7811 authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

Issue #27460: Unified error messages in bytes constructor for integers

in and out of the Py_ssize_t range.  Patch by Xiang Zhang.
üst 0122ae9a
...@@ -2624,7 +2624,7 @@ fail: ...@@ -2624,7 +2624,7 @@ fail:
\ \
for (i = 0; i < Py_SIZE(x); i++) { \ for (i = 0; i < Py_SIZE(x); i++) { \
item = GET_ITEM((x), i); \ item = GET_ITEM((x), i); \
value = PyNumber_AsSsize_t(item, PyExc_ValueError); \ value = PyNumber_AsSsize_t(item, NULL); \
if (value == -1 && PyErr_Occurred()) \ if (value == -1 && PyErr_Occurred()) \
goto error; \ goto error; \
\ \
...@@ -2687,7 +2687,7 @@ _PyBytes_FromIterator(PyObject *it, PyObject *x) ...@@ -2687,7 +2687,7 @@ _PyBytes_FromIterator(PyObject *it, PyObject *x)
} }
/* Interpret it as an int (__index__) */ /* Interpret it as an int (__index__) */
value = PyNumber_AsSsize_t(item, PyExc_ValueError); value = PyNumber_AsSsize_t(item, NULL);
Py_DECREF(item); Py_DECREF(item);
if (value == -1 && PyErr_Occurred()) if (value == -1 && PyErr_Occurred())
goto error; goto error;
......
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