Skip to content

Commit 20c3b5b

Browse files
committed
[IMP] util/pg: skip None counts when summing
[cr.rowcount](https://www.psycopg.org/docs/cursor.html#cursor.rowcount) may start (at some non-disclosed point) to return `None` instead of `-1`. Which would cause the following error: ```python TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' ``` Part-of: #49
1 parent 9221213 commit 20c3b5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/pg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def execute(query):
118118
log_hundred_percent=True,
119119
):
120120
try:
121-
tot_cnt += future.result()
121+
tot_cnt += future.result() or 0
122122
except psycopg2.OperationalError as exc:
123123
if exc.pgcode not in CONCURRENCY_ERRORCODES:
124124
raise

0 commit comments

Comments
 (0)