]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
refactor: drop superfluous _rowcount reset
authorDenis Laxalde <denis@laxalde.org>
Sun, 8 Jan 2023 14:48:38 +0000 (15:48 +0100)
committerDenis Laxalde <denis@laxalde.org>
Sun, 8 Jan 2023 14:48:38 +0000 (15:48 +0100)
In BaseCursor._set_results_from_pipeline() we were resetting _rowcount
if negative. This is superfluous as this code is reached when coming
from _executemany_gen_pipeline() in which we already do
'self._rowcount = 0' early on.

psycopg/psycopg/cursor.py

index 42c3804a1f518a5222c0585b599725727a1a1ca1..08cdcb7510c5798895d6ce5cabb818b400ead739 100644 (file)
@@ -551,8 +551,6 @@ class BaseCursor(Generic[ConnectionType, Row]):
             # change it to the value of that result only, but we hope nobody
             # will notice.
             # You haven't read this comment.
-            if self._rowcount < 0:
-                self._rowcount = 0
             for res in results:
                 self._rowcount += res.command_tuples or 0