-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
fallback to native traceback when handling ExceptionGroup (take 2) [SQUASH] #10209
Conversation
commit 41d339c46763bbe26123e1e6504b6e32290e33e1 Author: Cheukting <cheukting.ho@gmail.com> Date: Thu Jun 23 17:01:04 2022 +0800 test in all py versions commit b3572a5a12672228c3276fc8c8e05980dfb7888a Author: Cheukting <cheukting.ho@gmail.com> Date: Thu Jun 23 16:41:06 2022 +0800 add test commit 7166a2a51e4f99046b028b663c193d8b558c7fd4 Author: Cheukting <cheukting.ho@gmail.com> Date: Thu Jun 23 16:00:07 2022 +0800 update changelog commit b958c73d489157f0c0d4e46425083a5e2e2bc851 Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu Jun 23 07:50:52 2022 +0000 [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci commit ea7f376c6ca37c40c83df0e4a1cfaaedb34bae91 Author: Cheukting <cheukting.ho@gmail.com> Date: Thu Jun 23 15:48:21 2022 +0800 Fix MyPy commit 97469beb1da40257e9a061a5e19548546c9312c4 Author: Cheukting <cheukting.ho@gmail.com> Date: Thu Jun 23 15:03:48 2022 +0800 fix if ExceptionGroup not exist commit 84e553642cd69b4d499231d733df91ebfa84c7ad Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu Jun 23 03:43:27 2022 +0000 [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci commit 76bbef449b88bbd74fb5cca3b5293337a624ef03 Author: Cheukting <cheukting.ho@gmail.com> Date: Thu Jun 23 11:40:41 2022 +0800 adding changelog commit db82bebc5a4969e2083adcd97bdfd2a63bb17d98 Author: Cheukting <cheukting.ho@gmail.com> Date: Thu Jun 23 11:33:10 2022 +0800 fall back to native when handeling to exception groups
…ceptionchain (excinfo->excinfo_, set reprcrash. Extended tests, though they're wip.
failing code coverage is partly for the 3.11-only test, and partly for the code written for when |
also shoutout to @Cheukting for giving a good base to work off of. I'll add you to |
Thank you @jakkdl 😊 |
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.
Two comments below; otherwise both tests and implementation look good to me. I've also confirmed that it works locally 👍
Definitely add Cheuk to the authors list though, it's important to give OSS credit (and copyright acknowledgement!) where it's due.
Tagging @RonnyPfannschmidt for review too because I'm pretty close to the whole ExceptionGroup project, between PEP-678 and implementing support in Hypothesis. |
…irectly defining BaseExceptionGroup, added block comment, added match line for inner exception, changked mark.skipif to importorskip to not need top-level import, changed tox.ini a bit - only uncovered should now be py37 without exceptiongroup, due to hypothesis
Fixed comments, although Cheukting is already in I managed to figure out how to add a tox testenv to test py37 without exceptiongroup installed, but it's quite a hassle and doesn't seem worth it just to test ~2 lines of code. |
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.
Looks great to me - thanks @jakkdl!
If I don't hear any objections (@nicoddemus @RonnyPfannschmidt), I'll merge this on Friday.
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.
Left a few comments, please take a look.
… dependency on py<3.11, renamed bad variable names
Since @agronholm - pytest is considering adding a dependency on |
The only reason I've held back the final release is to ensure that it matches the behavior of Python 3.11 in its final release. And yes, I'm okay with pytest depending on |
pytest installs |
If it overrides those hooks, then it needs some way to manually render exception groups – something the |
I'd have thought that calling the And that's what Pytest's |
You're probably right – I am no so knowledgeable about the inner workings of the |
(I'm reconstructing rather than recalling, but) we don't need to register a |
As a high-level comment, I'd also observe that this PR seems like a strict improvement on the status quo, so I propose that we merge it (without the |
Yeah not much meaningful has changed after reviews, though the code is cleaner now ✨ |
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.
Looks great, thanks everyone for chiming in.
Let's please use squash when merging this. 👍 (I've added [SQUASH]
to the title as a reminder).
🎉🎉 Thanks to everyone involved! I'm looking forward to using this 😁 |
Picking up work on and therefore closes #10071 to temporarily address #9159
Improvements over the previous PR:
BaseExceptionGroup
excinfo_
instead ofexcinfo
, and setsreprcrash
I'm not entirely sure how to handle the envlist in tox.ini, since hypothesis currently depends on
exceptiongroup
, making an extra environment for it redundant. I also wanted a test for py311 withoutexceptiongroup
installed, but it got messy setting up a separate testenv withoutextras=testing
. An alternative is a 3.11-only test that modifies_pytest._code.code.ExceptionGroups
removingexceptiongroup.BaseExceptionGroup
from it.The test is still somewhat WIP, I want some extra matching lines to differentiate the parametrized variables, but thought I'd push my current work for initial review.
@Zac-HD