Mercurial > cpython-lru_cache-weakref
diff Modules/_sqlite/connection.c @ 75119:e67715b87131 3.2
sqlite3: Fix 64-bit integer handling in user functions on 32-bit architectures
Closes #8033.
| author | Petri Lehtinen <petri@digip.org> |
|---|---|
| date | Sun, 19 Feb 2012 21:38:00 +0200 |
| parents | a856be6688a6 |
| children | 55a89352e220 cf12fe9ce2b0 |
line wrap: on
line diff
--- a/Modules/_sqlite/connection.c Tue Feb 21 09:25:00 2012 +0200 +++ b/Modules/_sqlite/connection.c Sun Feb 19 21:38:00 2012 +0200 @@ -484,7 +484,6 @@ void _pysqlite_set_result(sqlite3_context* context, PyObject* py_val) { - long longval; const char* buffer; Py_ssize_t buflen; @@ -493,8 +492,7 @@ } else if (py_val == Py_None) { sqlite3_result_null(context); } else if (PyLong_Check(py_val)) { - longval = PyLong_AsLong(py_val); - sqlite3_result_int64(context, (PY_LONG_LONG)longval); + sqlite3_result_int64(context, PyLong_AsLongLong(py_val)); } else if (PyFloat_Check(py_val)) { sqlite3_result_double(context, PyFloat_AsDouble(py_val)); } else if (PyUnicode_Check(py_val)) { @@ -519,7 +517,6 @@ sqlite3_value* cur_value; PyObject* cur_py_value; const char* val_str; - PY_LONG_LONG val_int; Py_ssize_t buflen; args = PyTuple_New(argc); @@ -531,8 +528,7 @@ cur_value = argv[i]; switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: - val_int = sqlite3_value_int64(cur_value); - cur_py_value = PyLong_FromLong((long)val_int); + cur_py_value = PyLong_FromLongLong(sqlite3_value_int64(cur_value)); break; case SQLITE_FLOAT: cur_py_value = PyFloat_FromDouble(sqlite3_value_double(cur_value));
