--- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -829,6 +829,9 @@ PyObject* pysqlite_cursor_executescript( goto error; } + if (! statement) + break; + /* execute statement, and ignore results of SELECT statements */ rc = SQLITE_ROW; while (rc == SQLITE_ROW) {