]> granicus.if.org Git - python/commitdiff
Fix the sqlite failure -- it was the usual, PyInt_Check -> PyInt_CheckExact.
authorGuido van Rossum <guido@python.org>
Mon, 15 Jan 2007 00:31:49 +0000 (00:31 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 15 Jan 2007 00:31:49 +0000 (00:31 +0000)
Clarify some OverflowError messages from the various PyLong_AsXXX methods.

Misc/NEWS
Modules/_sqlite/statement.c
Objects/longobject.c

index 830a66a7e7ebe21ac1c89bdd70b6923eae661eee..0f19539a2a3ebfcabbb11a9134e29fd73014965c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -36,9 +36,9 @@ TO DO
 Core and Builtins
 -----------------
 
-- Int/Long unification is halfway complete.  There are a few broken tests,
-  the 'long' built-in hasn't been removed yet, and literals with trailing
-  'L' or 'l' are still recognized.  Performance may be sub-optimal.
+- Int/Long unification is halfway complete.  The 'long' built-in type
+  hasn't been removed yet, and literals with trailing 'L' or 'l' are
+  still recognized.  Performance may be sub-optimal.
 
 - 'except E, V' must now be spelled as 'except E as V' and deletes V
   at the end of the except clause; V must be a simple name.
index 4e45636140318a652fcb3e2567cb05a694ad97aa..7763d10e4c31f42749a1b5498ed6cce8dc577d13 100644 (file)
@@ -100,7 +100,7 @@ int statement_bind_parameter(Statement* self, int pos, PyObject* parameter)
 
     if (parameter == Py_None) {
         rc = sqlite3_bind_null(self->st, pos);
-    } else if (PyInt_Check(parameter)) {
+    } else if (PyInt_CheckExact(parameter)) {
         longval = PyInt_AsLong(parameter);
         rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longval);
 #ifdef HAVE_LONG_LONG
index 03d22f5d8f60bd880479ed1c052158402756dc7c..250215ca8bacab7b913993563a9243dccf6aa160 100644 (file)
@@ -364,7 +364,7 @@ PyLong_AsLong(PyObject *vv)
                Py_DECREF(vv);
        }
        PyErr_SetString(PyExc_OverflowError,
-                       "int too large to convert to int");
+                       "Python int too large to convert to C long");
        return -1;
 }
 
@@ -427,7 +427,7 @@ PyLong_AsSsize_t(PyObject *vv) {
 
  overflow:
        PyErr_SetString(PyExc_OverflowError,
-                       "int too large to convert to ");
+                       "Python int too large to convert to C ssize_t");
        return -1;
 }
 
@@ -462,7 +462,7 @@ PyLong_AsUnsignedLong(PyObject *vv)
                x = (x << SHIFT) + v->ob_digit[i];
                if ((x >> SHIFT) != prev) {
                        PyErr_SetString(PyExc_OverflowError,
-                               "int too large to convert");
+                        "python int too large to convert to C unsigned long");
                        return (unsigned long) -1;
                }
        }
@@ -500,7 +500,7 @@ PyLong_AsSize_t(PyObject *vv)
                x = (x << SHIFT) + v->ob_digit[i];
                if ((x >> SHIFT) != prev) {
                        PyErr_SetString(PyExc_OverflowError,
-                               "int too large to convert");
+                           "Python int too large to convert to C size_t");
                        return (unsigned long) -1;
                }
        }
@@ -943,7 +943,7 @@ PyLong_AsDouble(PyObject *vv)
 
 overflow:
        PyErr_SetString(PyExc_OverflowError,
-               "int too large to convert to float");
+               "Python int too large to convert to C double");
        return -1.0;
 }