Commit 4d3d0f21 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3,

such as was shipped with Centos 5 and Mac OS X 10.4.

This bug was already fixed in issue14572 for 2.7 only and then it was
backported back from 3.3 in issue17073.
parent 6b59f109
...@@ -17,6 +17,9 @@ Build ...@@ -17,6 +17,9 @@ Build
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3,
such as was shipped with Centos 5 and Mac OS X 10.4.
- Issue #17703: Fix a regression where an illegal use of Py_DECREF() after - Issue #17703: Fix a regression where an illegal use of Py_DECREF() after
interpreter finalization can cause a crash. interpreter finalization can cause a crash.
......
...@@ -732,7 +732,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* ...@@ -732,7 +732,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
Py_DECREF(self->lastrowid); Py_DECREF(self->lastrowid);
if (!multiple && statement_type == STATEMENT_INSERT) { if (!multiple && statement_type == STATEMENT_INSERT) {
sqlite3_int64 lastrowid; sqlite_int64 lastrowid;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
lastrowid = sqlite3_last_insert_rowid(self->connection->db); lastrowid = sqlite3_last_insert_rowid(self->connection->db);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
......
...@@ -111,7 +111,7 @@ int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st) ...@@ -111,7 +111,7 @@ int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st)
#endif #endif
PyObject * PyObject *
_pysqlite_long_from_int64(sqlite3_int64 value) _pysqlite_long_from_int64(sqlite_int64 value)
{ {
#ifdef HAVE_LONG_LONG #ifdef HAVE_LONG_LONG
# if SIZEOF_LONG_LONG < 8 # if SIZEOF_LONG_LONG < 8
...@@ -135,7 +135,7 @@ _pysqlite_long_from_int64(sqlite3_int64 value) ...@@ -135,7 +135,7 @@ _pysqlite_long_from_int64(sqlite3_int64 value)
return PyInt_FromLong(value); return PyInt_FromLong(value);
} }
sqlite3_int64 sqlite_int64
_pysqlite_long_as_int64(PyObject * py_val) _pysqlite_long_as_int64(PyObject * py_val)
{ {
int overflow; int overflow;
...@@ -158,8 +158,8 @@ _pysqlite_long_as_int64(PyObject * py_val) ...@@ -158,8 +158,8 @@ _pysqlite_long_as_int64(PyObject * py_val)
#endif #endif
return value; return value;
} }
else if (sizeof(value) < sizeof(sqlite3_int64)) { else if (sizeof(value) < sizeof(sqlite_int64)) {
sqlite3_int64 int64val; sqlite_int64 int64val;
if (_PyLong_AsByteArray((PyLongObject *)py_val, if (_PyLong_AsByteArray((PyLongObject *)py_val,
(unsigned char *)&int64val, sizeof(int64val), (unsigned char *)&int64val, sizeof(int64val),
IS_LITTLE_ENDIAN, 1 /* signed */) >= 0) { IS_LITTLE_ENDIAN, 1 /* signed */) >= 0) {
......
...@@ -36,7 +36,7 @@ int pysqlite_step(sqlite3_stmt* statement, pysqlite_Connection* connection); ...@@ -36,7 +36,7 @@ int pysqlite_step(sqlite3_stmt* statement, pysqlite_Connection* connection);
*/ */
int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st); int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st);
PyObject * _pysqlite_long_from_int64(sqlite3_int64 value); PyObject * _pysqlite_long_from_int64(sqlite_int64 value);
sqlite3_int64 _pysqlite_long_as_int64(PyObject * value); sqlite_int64 _pysqlite_long_as_int64(PyObject * value);
#endif #endif
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