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 Jul 21, 2021
1 parent 5313297 commit fad9ecf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Expand Up @@ -24,7 +24,8 @@ want to know what's different in 5.0 since 4.5.x, see :ref:`whatsnew5x`.
Unreleased
----------

Nothing yet.
- Fix another rarer instance of "Error binding parameter 0 - probably
unsupported type." (`issue 1010`_).


.. _changes_60b1:
Expand Down
8 changes: 7 additions & 1 deletion coverage/sqldata.py
Expand Up @@ -1119,7 +1119,13 @@ def executemany(self, sql, data):
if self.debug:
data = list(data)
self.debug.write(f"Executing many {sql!r} with {len(data)} rows")
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 fad9ecf

Please sign in to comment.