diff options
| author | Gerhard Häring <gh@ghaering.de> | 2007-12-11 21:07:40 (GMT) |
|---|---|---|
| committer | Gerhard Häring <gh@ghaering.de> | 2007-12-11 21:07:40 (GMT) |
| commit | 99b9df8e11ad6a80185a3a490759561710646c19 (patch) | |
| tree | f45406afbe38934b4c0790886098678a80ae6778 /Modules/_sqlite/util.c | |
| parent | 7a634e60272abf547d6a0c78f7a054e27773859f (diff) | |
| download | cpython-99b9df8e11ad6a80185a3a490759561710646c19.zip cpython-99b9df8e11ad6a80185a3a490759561710646c19.tar.gz cpython-99b9df8e11ad6a80185a3a490759561710646c19.tar.bz2 | |
Forward-port of commit 59184.
- 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
Diffstat (limited to 'Modules/_sqlite/util.c')
| -rw-r--r-- | Modules/_sqlite/util.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Modules/_sqlite/util.c b/Modules/_sqlite/util.c index b70297b..5e78d58 100644 --- a/Modules/_sqlite/util.c +++ b/Modules/_sqlite/util.c @@ -28,9 +28,15 @@ int _sqlite_step_with_busyhandler(sqlite3_stmt* statement, pysqlite_Connection* { 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; } |
