[Python-checkins] cpython: Issue #27460: Unified error messages in bytes constructor for integers

serhiy.storchaka python-checkins at python.org
Wed Jul 6 14:40:16 EDT 2016


https://hg.python.org/cpython/rev/f9481e5f1792
changeset:   102261:f9481e5f1792
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Jul 06 21:39:44 2016 +0300
summary:
  Issue #27460: Unified error messages in bytes constructor for integers
in and out of the Py_ssize_t range.  Patch by Xiang Zhang.

files:
  Objects/bytesobject.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -2624,7 +2624,7 @@
                                                                             \
         for (i = 0; i < Py_SIZE(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())                            \
                 goto error;                                                 \
                                                                             \
@@ -2687,7 +2687,7 @@
         }
 
         /* Interpret it as an int (__index__) */
-        value = PyNumber_AsSsize_t(item, PyExc_ValueError);
+        value = PyNumber_AsSsize_t(item, NULL);
         Py_DECREF(item);
         if (value == -1 && PyErr_Occurred())
             goto error;

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list