Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion aiomysql/cursors.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,8 @@ class SSCursor(Cursor):

async def close(self):
conn = self._connection
if conn is None:
if conn is None or conn.closed:
self._connection = None
return

if self._result is not None and self._result is conn._result:
Expand Down
9 changes: 9 additions & 0 deletions tests/test_sscursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ async def test_ssursor(connection):
await cursor.close()


@pytest.mark.run_loop
async def test_ssursor_conn_closed(connection):
conn = connection
cursor = await conn.cursor(SSCursor)

conn.close()
await cursor.close()


@pytest.mark.run_loop
async def test_sscursor_fetchall(connection):
conn = connection
Expand Down