summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-08-21 16:41:38 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-08-21 16:41:38 (GMT)
commitd7f3cdd07d7387787c18c0c34a71ee00d77a26c8 (patch)
treee5e316753262fbdfd803f06d051c9153eede98fe /Modules
parent1dc3c898a844594440fb46a56b76208c1e63890a (diff)
parent6afe85827c209b9d1e76a65ffdb7420b5f46ad3d (diff)
downloadcpython-d7f3cdd07d7387787c18c0c34a71ee00d77a26c8.zip
cpython-d7f3cdd07d7387787c18c0c34a71ee00d77a26c8.tar.gz
cpython-d7f3cdd07d7387787c18c0c34a71ee00d77a26c8.tar.bz2
Issue #21718: Merge from 3.5
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sqlite/cursor.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 9b20678..98eb961 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -645,12 +645,11 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
goto error;
}
- if (rc == SQLITE_ROW || (rc == SQLITE_DONE && statement_type == STATEMENT_SELECT)) {
- if (self->description == Py_None) {
- Py_BEGIN_ALLOW_THREADS
- numcols = sqlite3_column_count(self->statement->st);
- Py_END_ALLOW_THREADS
-
+ if (rc == SQLITE_ROW || rc == SQLITE_DONE) {
+ Py_BEGIN_ALLOW_THREADS
+ numcols = sqlite3_column_count(self->statement->st);
+ Py_END_ALLOW_THREADS
+ if (self->description == Py_None && numcols > 0) {
Py_SETREF(self->description, PyTuple_New(numcols));
if (!self->description) {
goto error;