Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure coroutine is awaited when discarding results in SSCursor #701

Merged
merged 1 commit into from
Jan 28, 2022
Merged
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
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ To be included in 1.0.0 (unreleased)
* Ensure connections are properly closed before raising an InternalError when packet sequence numbers are out of sync #660
* Unix sockets are now internally considered secure, allowing sha256_password and caching_sha2_password auth methods to be used #695
* Test suite now also tests unix socket connections #696
* Fix SSCursor raising InternalError when last result was not fully retrieved #635


0.0.22 (2021-11-14)
Expand Down
2 changes: 1 addition & 1 deletion aiomysql/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ async def _execute_command(self, command, sql):
if self._result is not None:
if self._result.unbuffered_active:
warnings.warn("Previous unbuffered result was left incomplete")
self._result._finish_unbuffered_query()
await self._result._finish_unbuffered_query()
while self._result.has_next:
await self.next_result()
self._result = None
Expand Down
9 changes: 2 additions & 7 deletions tests/test_sscursor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio

import pytest
from pymysql import NotSupportedError, InternalError
from pymysql import NotSupportedError

from aiomysql import ProgrammingError, InterfaceError
from aiomysql.cursors import SSCursor
Expand Down Expand Up @@ -190,11 +190,6 @@ async def read_cursor():
await conn.cursor(SSCursor)


@pytest.mark.xfail(
reason="https://github.com/aio-libs/aiomysql/issues/635",
raises=InternalError,
strict=True,
)
@pytest.mark.run_loop
async def test_sscursor_discarded_result(connection):
conn = connection
Expand All @@ -203,4 +198,4 @@ async def test_sscursor_discarded_result(connection):
await cursor.execute("select 1")
await cursor.execute("select 2")
ret = await cursor.fetchone()
assert (1,) == ret
assert (2,) == ret