Commit b1ef029b authored by Guido van Rossum's avatar Guido van Rossum

Fix the sqlite failure -- it was the usual, PyInt_Check -> PyInt_CheckExact.

Clarify some OverflowError messages from the various PyLong_AsXXX methods.
parent 3d1dbb29
...@@ -36,9 +36,9 @@ TO DO ...@@ -36,9 +36,9 @@ TO DO
Core and Builtins Core and Builtins
----------------- -----------------
- Int/Long unification is halfway complete. There are a few broken tests, - Int/Long unification is halfway complete. The 'long' built-in type
the 'long' built-in hasn't been removed yet, and literals with trailing hasn't been removed yet, and literals with trailing 'L' or 'l' are
'L' or 'l' are still recognized. Performance may be sub-optimal. still recognized. Performance may be sub-optimal.
- 'except E, V' must now be spelled as 'except E as V' and deletes V - '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. at the end of the except clause; V must be a simple name.
......
...@@ -100,7 +100,7 @@ int statement_bind_parameter(Statement* self, int pos, PyObject* parameter) ...@@ -100,7 +100,7 @@ int statement_bind_parameter(Statement* self, int pos, PyObject* parameter)
if (parameter == Py_None) { if (parameter == Py_None) {
rc = sqlite3_bind_null(self->st, pos); rc = sqlite3_bind_null(self->st, pos);
} else if (PyInt_Check(parameter)) { } else if (PyInt_CheckExact(parameter)) {
longval = PyInt_AsLong(parameter); longval = PyInt_AsLong(parameter);
rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longval); rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longval);
#ifdef HAVE_LONG_LONG #ifdef HAVE_LONG_LONG
......
...@@ -364,7 +364,7 @@ PyLong_AsLong(PyObject *vv) ...@@ -364,7 +364,7 @@ PyLong_AsLong(PyObject *vv)
Py_DECREF(vv); Py_DECREF(vv);
} }
PyErr_SetString(PyExc_OverflowError, PyErr_SetString(PyExc_OverflowError,
"int too large to convert to int"); "Python int too large to convert to C long");
return -1; return -1;
} }
...@@ -427,7 +427,7 @@ PyLong_AsSsize_t(PyObject *vv) { ...@@ -427,7 +427,7 @@ PyLong_AsSsize_t(PyObject *vv) {
overflow: overflow:
PyErr_SetString(PyExc_OverflowError, PyErr_SetString(PyExc_OverflowError,
"int too large to convert to "); "Python int too large to convert to C ssize_t");
return -1; return -1;
} }
...@@ -462,7 +462,7 @@ PyLong_AsUnsignedLong(PyObject *vv) ...@@ -462,7 +462,7 @@ PyLong_AsUnsignedLong(PyObject *vv)
x = (x << SHIFT) + v->ob_digit[i]; x = (x << SHIFT) + v->ob_digit[i];
if ((x >> SHIFT) != prev) { if ((x >> SHIFT) != prev) {
PyErr_SetString(PyExc_OverflowError, PyErr_SetString(PyExc_OverflowError,
"int too large to convert"); "python int too large to convert to C unsigned long");
return (unsigned long) -1; return (unsigned long) -1;
} }
} }
...@@ -500,7 +500,7 @@ PyLong_AsSize_t(PyObject *vv) ...@@ -500,7 +500,7 @@ PyLong_AsSize_t(PyObject *vv)
x = (x << SHIFT) + v->ob_digit[i]; x = (x << SHIFT) + v->ob_digit[i];
if ((x >> SHIFT) != prev) { if ((x >> SHIFT) != prev) {
PyErr_SetString(PyExc_OverflowError, PyErr_SetString(PyExc_OverflowError,
"int too large to convert"); "Python int too large to convert to C size_t");
return (unsigned long) -1; return (unsigned long) -1;
} }
} }
...@@ -943,7 +943,7 @@ PyLong_AsDouble(PyObject *vv) ...@@ -943,7 +943,7 @@ PyLong_AsDouble(PyObject *vv)
overflow: overflow:
PyErr_SetString(PyExc_OverflowError, PyErr_SetString(PyExc_OverflowError,
"int too large to convert to float"); "Python int too large to convert to C double");
return -1.0; return -1.0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment