Skip to content

Commit baa7eec

Browse files
committed
.
1 parent 3b50390 commit baa7eec

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Lib/test/test_sqlite3/test_dbapi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,10 +1079,11 @@ def __init__(self, cx, value):
10791079
self.value = value
10801080

10811081
def __getitem__(self, i):
1082+
if self.value == 3:
1083+
self.side_effect()
10821084
return self.value
10831085

10841086
def __len__(self):
1085-
self.side_effect()
10861087
return 1
10871088

10881089
class Ps(CxWrapper):

Modules/_sqlite/cursor.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,9 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
941941
}
942942

943943
bind_parameters(state, self->statement, parameters);
944+
// Note: bind_parameters() can have a side effect on the connection's
945+
// state that could only be visible on the next API usage if we do not
946+
// check it now.
944947
if (PyErr_Occurred() || !pysqlite_check_connection(self->connection)) {
945948
goto error;
946949
}

0 commit comments

Comments
 (0)