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

gh-102799: use sys.exception() instead of sys.exc_info() in tests #103293

Merged
merged 9 commits into from
Apr 6, 2023

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Apr 5, 2023

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.

Copy link
Member

@gvanrossum gvanrossum left a 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.

@@ -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)
Copy link
Member

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.)

@iritkatriel iritkatriel merged commit 482b6ee into python:main Apr 6, 2023
warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants