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

Correctly handle tracebackhide for chained exceptions #10772

Conversation

Felhof
Copy link
Contributor

@Felhof Felhof commented Feb 28, 2023

Closes #1904.
Fixes a bug that causes the last entry of a traceback to always be shown, even if it supposed to be hidden.
Also includes a unit test based on the suggestion from the issue discussion.

AUTHORS:
Felix Hofstätter

* The test still assumed that Traceback.getcrashentry would return the last element from the traceback when all elements were hidden. However, that was erroneous behavior which was fixed in a583c68
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Great work on digging up that old issue! 😁

I left a comment, in addition to that could you also please:

  • Add yourself to the AUTHORS file.

  • Add a changelog entry by creating a new file changelog/1904.bugfix.rst and describe the problem at the user level, for example:

    Correctly handle ``__tracebackhide__`` for chained exceptions.

Thanks!

testing/test_tracebackhide.py Show resolved Hide resolved
@nicoddemus
Copy link
Member

Thanks! Can you take a look at the mypy failures please?

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Thanks!

I will leave this open for a few days in case others want to review.

@nicoddemus nicoddemus merged commit 431ec6d into pytest-dev:main Mar 15, 2023
bluetech added a commit to bluetech/pytest that referenced this pull request Apr 12, 2023
bluetech added a commit that referenced this pull request Apr 13, 2023
Revert "Correctly handle tracebackhide for chained exceptions (#10772)"
bluetech added a commit that referenced this pull request Apr 13, 2023
[7.3.x] Revert "Correctly handle tracebackhide for chained exceptions (#10772)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

__tracebackhide__ does not work with chained exceptions
2 participants