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-92118: Add test for traceback when exception is modified by ExitStack.__exit__ #92339

Merged
merged 3 commits into from May 5, 2022

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented May 5, 2022

No description provided.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Is it the same in 3.10?


self.assertIsInstance(exc, ValueError)
ve_frames = traceback.extract_tb(exc.__traceback__)
self.assertEqual(len(ve_frames), 5)
Copy link
Member

@serhiy-storchaka serhiy-storchaka May 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is redundant, And if it fail, the report will be less informative than failing the test which compares lists.

@iritkatriel
Copy link
Member Author

iritkatriel commented May 5, 2022

Is it the same in 3.10?

It is.

@iritkatriel
Copy link
Member Author

iritkatriel commented May 5, 2022

Hmm. contextlib_async tests use this test and get a different traceback.

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented May 5, 2022

You can parametrize the test. Set the expected result as an attribute of the class.

@iritkatriel
Copy link
Member Author

iritkatriel commented May 5, 2022

Thanks. The 3.10 backport will fail because it doesn't have import traceback, but I'll fix it.

@iritkatriel iritkatriel merged commit e65e587 into python:main May 5, 2022
12 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented May 5, 2022

Thanks @iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 5, 2022
…(Async)ExitStack.__exit__ (pythonGH-92339)

(cherry picked from commit e65e587)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
@bedevere-bot
Copy link

bedevere-bot commented May 5, 2022

GH-92343 is a backport of this pull request to the 3.10 branch.

iritkatriel pushed a commit that referenced this pull request May 5, 2022
@iritkatriel iritkatriel deleted the exitstack branch May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news stdlib Python modules in the Lib dir tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants