-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
gh-102799: use sys.exception() instead of sys.exc_info() in tests #103293
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit, no need to wait for another approval after you fix it.
Lib/test/test_asyncio/test_tasks.py
Outdated
@@ -606,7 +606,7 @@ def on_timeout(): | |||
if ( | |||
timed_out | |||
and task.uncancel() == 0 | |||
and sys.exc_info()[0] is asyncio.CancelledError | |||
and isinstance(sys.exception(), asyncio.CancelledError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add the isinstance()
call? The original test insists that you get exactly CancelledError
. I think that's useful to test for, since not all cancellation code is resilient to subclasses of CancelledError
.
(In other cases below I don't mind.)
Now that 3.10 is no longer getting bugfixes, we can use sys.exception() without worrying about it impacting bugfix backports (it exists since 3.11).
This PR does the tests.