From d751105a36cae2855dc5fe1d6335d838c27f1de5 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 5 Oct 2002 21:14:12 +0000 Subject: Backport 2.103: Made conversion failure error messages consistent between types. --- Objects/abstract.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c index 047f62f..1d574da 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -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 * -- cgit v0.12