[Python-checkins] bpo-16055: Fixes incorrect error text for int('1', base=1000) (#6980)

Victor Stinner webhook-mailer at python.org
Fri May 18 19:53:17 EDT 2018


https://github.com/python/cpython/commit/d13169fc5ac7572a272cbcff830c3d96ba27cc7c
commit: d13169fc5ac7572a272cbcff830c3d96ba27cc7c
branch: 2.7
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018-05-19T01:53:13+02:00
summary:

bpo-16055: Fixes incorrect error text for int('1', base=1000) (#6980)

Fixes incorrect error text for int('1', base=1000)
and long('1', base=1000).

files:
M Objects/intobject.c
M Objects/longobject.c

diff --git a/Objects/intobject.c b/Objects/intobject.c
index 3ab00af1e28c..9b27c35d88d0 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -358,7 +358,7 @@ PyInt_FromString(char *s, char **pend, int base)
 
     if ((base != 0 && base < 2) || base > 36) {
         PyErr_SetString(PyExc_ValueError,
-                        "int() base must be >= 2 and <= 36");
+                        "int() base must be >= 2 and <= 36, or 0");
         return NULL;
     }
 
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 5d6ce70d537d..f40ad7ab1b8c 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -1722,7 +1722,7 @@ PyLong_FromString(char *str, char **pend, int base)
 
     if ((base != 0 && base < 2) || base > 36) {
         PyErr_SetString(PyExc_ValueError,
-                        "long() arg 2 must be >= 2 and <= 36");
+                        "long() base must be >= 2 and <= 36, or 0");
         return NULL;
     }
     while (*str != '\0' && isspace(Py_CHARMASK(*str)))



More information about the Python-checkins mailing list