summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2021-03-29 21:58:38 +0200
committerMike Bayer <mike_mp@zzzcomputing.com>2021-03-30 19:13:58 -0400
commit3df6a3f1fbb589110c3ef3f344758bb11d3dc3df (patch)
tree1bbae67210743eb3c51013300ad6aaf9bbcc1754 /lib/sqlalchemy
parent6d21db90147411790b811be573f7cc347f5bf1bf (diff)
downloadsqlalchemy-3df6a3f1fbb589110c3ef3f344758bb11d3dc3df.tar.gz
Repair exception handling in CursorResult
Fixes: #6138 Change-Id: I794a3da688fd8577fb06770ef02bf827a5c55397
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/engine/cursor.py4
-rw-r--r--lib/sqlalchemy/testing/suite/test_update_delete.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/engine/cursor.py b/lib/sqlalchemy/engine/cursor.py
index b5b92b171..5a3b92901 100644
--- a/lib/sqlalchemy/engine/cursor.py
+++ b/lib/sqlalchemy/engine/cursor.py
@@ -1624,7 +1624,7 @@ class BaseCursorResult(object):
try:
return self.context.rowcount
except BaseException as e:
- self.cursor_strategy.handle_exception(self, e)
+ self.cursor_strategy.handle_exception(self, self.cursor, e)
@property
def lastrowid(self):
@@ -1645,7 +1645,7 @@ class BaseCursorResult(object):
try:
return self.context.get_lastrowid()
except BaseException as e:
- self.cursor_strategy.handle_exception(self, e)
+ self.cursor_strategy.handle_exception(self, self.cursor, e)
@property
def returns_rows(self):
diff --git a/lib/sqlalchemy/testing/suite/test_update_delete.py b/lib/sqlalchemy/testing/suite/test_update_delete.py
index 3fb51ead3..f5ee2e028 100644
--- a/lib/sqlalchemy/testing/suite/test_update_delete.py
+++ b/lib/sqlalchemy/testing/suite/test_update_delete.py
@@ -37,6 +37,7 @@ class SimpleUpdateDeleteTest(fixtures.TablesTest):
)
assert not r.is_insert
assert not r.returns_rows
+ assert r.rowcount == 1
eq_(
connection.execute(t.select().order_by(t.c.id)).fetchall(),
@@ -48,6 +49,7 @@ class SimpleUpdateDeleteTest(fixtures.TablesTest):
r = connection.execute(t.delete().where(t.c.id == 2))
assert not r.is_insert
assert not r.returns_rows
+ assert r.rowcount == 1
eq_(
connection.execute(t.select().order_by(t.c.id)).fetchall(),
[(1, "d1"), (3, "d3")],