]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport 2.103:
authorRaymond Hettinger <python@rcn.com>
Sat, 5 Oct 2002 21:14:12 +0000 (21:14 +0000)
committerRaymond Hettinger <python@rcn.com>
Sat, 5 Oct 2002 21:14:12 +0000 (21:14 +0000)
Made conversion failure error messages consistent between types.

Objects/abstract.c

index 047f62f017b988a6553d46c8f5ab139c98ea3307..1d574da6575f96a95aacdc6bd9731d97d2389fb5 100644 (file)
@@ -903,7 +903,7 @@ PyNumber_Int(PyObject *o)
        if (!PyObject_AsCharBuffer(o, &buffer, &buffer_len))
                return int_from_string((char*)buffer, buffer_len);
 
-       return type_error("object can't be converted to int");
+       return type_error("int() argument must be a string or a number");
 }
 
 /* Add a check for embedded NULL-bytes in the argument. */
@@ -960,7 +960,7 @@ PyNumber_Long(PyObject *o)
        if (!PyObject_AsCharBuffer(o, &buffer, &buffer_len))
                return long_from_string(buffer, buffer_len);
 
-       return type_error("object can't be converted to long");
+       return type_error("long() argument must be a string or a number");
 }
 
 PyObject *