Skip to content

gh-92118: Add test for traceback when exception is modified by ExitStack.__exit__ #92339

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

Merged
merged 3 commits into from
May 5, 2022

Conversation

iritkatriel
Copy link
Member

No description provided.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

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

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

Is it the same in 3.10?

It is.

@iritkatriel
Copy link
Member Author

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

@serhiy-storchaka
Copy link
Member

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

@iritkatriel
Copy link
Member Author

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
@miss-islington
Copy link
Contributor

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 <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label May 5, 2022
@bedevere-bot
Copy link

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 11:20
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.

4 participants