Mercurial > cpython-lru_cache-weakref
diff Modules/_sqlite/util.c @ 44022:52bbe3365c72 2.5
- Backported a workaround for a bug in SQLite 3.2.x/3.3.x versions where a
statement recompilation with no bound parameters lead to a segfault
- Backported a fix necessary because of an SQLite API change in version 3.5.
This prevents segfaults when executing empty queries, like our test suite
does.
| author | Gerhard Häring <gh@ghaering.de> |
|---|---|
| date | Sun, 25 Nov 2007 17:40:35 +0000 |
| parents | c4ac6ea497a1 |
| children | 787b969d37f0 |
line wrap: on
line diff
--- a/Modules/_sqlite/util.c Sat Nov 24 14:31:16 2007 +0000 +++ b/Modules/_sqlite/util.c Sun Nov 25 17:40:35 2007 +0000 @@ -29,9 +29,15 @@ { int rc; - Py_BEGIN_ALLOW_THREADS - rc = sqlite3_step(statement); - Py_END_ALLOW_THREADS + if (statement == NULL) { + /* this is a workaround for SQLite 3.5 and later. it now apparently + * returns NULL for "no-operation" statements */ + rc = SQLITE_OK; + } else { + Py_BEGIN_ALLOW_THREADS + rc = sqlite3_step(statement); + Py_END_ALLOW_THREADS + } return rc; }
