-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-29762: More use "raise from None". #569
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
bpo-29762: More use "raise from None". #569
Conversation
This hides unwanted implementation details from tracebacks.
wm75
left a comment
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.
Generally, I think this is a good idea, but only if there is absolutely no loss of information, which happens at least for two of your changes (see comments, there may be others that I've missed)
Lib/encodings/punycode.py
Outdated
| except IndexError: | ||
| if errors == "strict": | ||
| raise UnicodeError("incomplete punicode string") | ||
| raise UnicodeError("incomplete punicode string") from None |
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.
information about extpos is lost here
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.
Done. And there are other bugs in this codec.
Lib/mailbox.py
Outdated
| except UnicodeError: | ||
| raise ValueError("String input must be ASCII-only; " | ||
| "use bytes or a Message instead") | ||
| "use bytes or a Message instead") from None |
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.
information about problematic character in the string is lost
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.
Done.
|
FYI It's hard to review such change, because each change should be carefully reviewed, whereas the change modifies 31 files. So I decided to skip my turn, maybe review it another day :-) |
Lib/json/tool.py
Outdated
| object_pairs_hook=collections.OrderedDict) | ||
| except ValueError as e: | ||
| raise SystemExit(e) | ||
| raise SystemExit(e) from None |
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.
I'm note sure about this one.
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.
Agree. It just doesn't have any visible effect. The original exception is passes to SystemExit, and str(e) is printed to stderr at exit. __cause__ and __context__ are ignored.
|
Except for the one noted in the comment, these all look good. |
Codecov Report
@@ Coverage Diff @@
## master #569 +/- ##
==========================================
+ Coverage 83.42% 83.46% +0.03%
==========================================
Files 1367 1367
Lines 345769 346382 +613
==========================================
+ Hits 288474 289117 +643
+ Misses 57295 57265 -30
Continue to review full report at Codecov.
|
|
Thank you for your review @wm75 and @rhettinger. |
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.18.3 to 0.19.0. - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-asyncio@v0.18.3...v0.19.0) --- updated-dependencies: - dependency-name: pytest-asyncio dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This hides unwanted implementation details from tracebacks.