Skip to content

Commit b1d18b7

Browse files
committed
fix: retry immediately on a failure inside executemany. #1010
1 parent 66173dc commit b1d18b7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

coverage/sqldata.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,13 @@ def executemany(self, sql, data):
11031103
if self.debug:
11041104
data = list(data)
11051105
self.debug.write("Executing many {!r} with {} rows".format(sql, len(data)))
1106-
return self.con.executemany(sql, data)
1106+
try:
1107+
return self.con.executemany(sql, data)
1108+
except Exception:
1109+
# In some cases, an error might happen that isn't really an
1110+
# error. Try again immediately.
1111+
# https://github.com/nedbat/coveragepy/issues/1010
1112+
return self.con.executemany(sql, data)
11071113

11081114
def executescript(self, script):
11091115
"""Same as :meth:`python:sqlite3.Connection.executescript`."""

0 commit comments

Comments
 (0)