-
Couldn't load subscription status.
- Fork 266
SSCursor: Fix connection closed check #991
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
base: main
Are you sure you want to change the base?
Conversation
Since the connection closes itself on an `asyncio.CancelledError`, it cannot be used afterwards. `SSCursor.close` attempts to clear some unfinished state first before closing using `Connection._finish_unbuffered_query`, but that call fails if the connection has been closed already and SSCursor itself does not properly check that.
0fa2c8b to
a085bc5
Compare
|
Tests are passing but submitting coverage data failed. |
|
Here's another situation where the connection already closes itself on an error (incomplete read/connection loss) and then the SSCursor's |
What do these changes do?
Since the connection closes itself on an
asyncio.CancelledError, it cannot be used afterwards.SSCursor.closeattempts to clear some unfinished state first before closing usingConnection._finish_unbuffered_query, but that call fails if the connection has been closed already and SSCursor itself does not properly check that.Are there changes in behavior for the user?
Cancellations now do not raise an unhandled exception anymore when using the connection and the SSCursor in a context manager.
Following is an example traceback where both the connection and the SSCursor are used in an AsyncExitStack and the task was cancelled:
Related issue number
Checklist