| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…in an ExceptionGroup
| match, rest = excinst.split(self._exceptions) | ||
| if rest is None: | ||
| return True | ||
| raise rest |
There was a problem hiding this comment.
This isn't ideal as it makes the exception group's own traceback include the def __exit__(...) frame. For example:
File "/Volumes/RAMDisk/cpython/Lib/test/test_contextlib.py", line 1220, in test_exception_groups
with suppress(ValueError):
File "/Volumes/RAMDisk/cpython/Lib/contextlib.py", line 454, in __exit__
raise rest from excinst
File "/Volumes/RAMDisk/cpython/Lib/test/test_contextlib.py", line 1221, in test_exception_groups
raise eg_all()
in case of the newly added test.
This isn't a big problem because:
Ideally, we wouldn't need this. However, the API of __exit__ makes it impossible to replace the ExceptionGroup instance with another one, while ExceptionGroup itself makes its exceptions read-only.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. Minor doc tweaks.
Sorry, something went wrong.
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
There was a problem hiding this comment.
(just testing out "request changes")
Sorry, something went wrong.
|
When you're done making the requested changes, leave the comment: I have made the requested changes; please review again. |
Sorry, something went wrong.
OK, GitHub indeed doesn't disable auto-merge when changes are requested
* main: pythongh-87729: add LOAD_SUPER_ATTR instruction for faster super() (python#103497) pythongh-103791: Make contextlib.suppress also act on exceptions within an ExceptionGroup (python#103792)
| return | ||
| if issubclass(exctype, self._exceptions): | ||
| return True | ||
| if issubclass(exctype, ExceptionGroup): |
There was a problem hiding this comment.
Was there a specific reason to handle ExceptionGroup but not BaseExceptionGroup?
Sorry, something went wrong.
There was a problem hiding this comment.
I doubt it. Want to make a PR?
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.