Skip to content

Commit

Permalink
fix: retry immediately on a failure inside executemany. #1010
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Apr 6, 2021
1 parent 66173dc commit b1d18b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion coverage/sqldata.py
Expand Up @@ -1103,7 +1103,13 @@ def executemany(self, sql, data):
if self.debug:
data = list(data)
self.debug.write("Executing many {!r} with {} rows".format(sql, len(data)))
return self.con.executemany(sql, data)
try:
return self.con.executemany(sql, data)
except Exception:
# In some cases, an error might happen that isn't really an
# error. Try again immediately.
# https://github.com/nedbat/coveragepy/issues/1010
return self.con.executemany(sql, data)

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

0 comments on commit b1d18b7

Please sign in to comment.