Fix for CONPY-221:

Removed __del__ method from cursors.py to prevent
raisiing if cursor was already properly closed via close()
method.
This commit is contained in:
Georg Richter
2022-08-27 07:25:09 +02:00
parent d18a2405c6
commit c3fe1a954e
2 changed files with 13 additions and 4 deletions

View File

@ -637,7 +637,6 @@ class TestCursor(unittest.TestCase):
def test_closed(self):
cursor = self.connection.cursor()
cursor.close()
cursor.close()
self.assertEqual(cursor.closed, True)
try:
cursor.execute("set @a:=1")
@ -1420,6 +1419,19 @@ class TestCursor(unittest.TestCase):
del cursor
del conn
def test_conpy221(self):
conn = create_connection()
cursor = conn.cursor()
cursor.close()
del cursor
cursor = conn.cursor()
del cursor
try:
cursor.close() # noqa: F821
except Exception:
pass
def test_conpy91(self):
with create_connection() as connection:
with connection.cursor() as cursor: