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

bpo-29762: More use "raise from None". #569

Merged

Conversation

serhiy-storchaka
Copy link
Member

This hides unwanted implementation details from tracebacks.

This hides unwanted implementation details from tracebacks.
@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Mar 8, 2017
Copy link

@wm75 wm75 left a 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)

@@ -134,7 +134,7 @@ def decode_generalized_number(extended, extpos, bias, errors):
char = ord(extended[extpos])
except IndexError:
if errors == "strict":
raise UnicodeError("incomplete punicode string")
raise UnicodeError("incomplete punicode string") from None
Copy link

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

Copy link
Member Author

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
@@ -201,7 +201,7 @@ def _string_to_bytes(self, message):
return message.encode('ascii')
except UnicodeError:
raise ValueError("String input must be ASCII-only; "
"use bytes or a Message instead")
"use bytes or a Message instead") from None
Copy link

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@vstinner
Copy link
Member

vstinner commented Mar 9, 2017

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
@@ -40,7 +40,7 @@ def main():
obj = json.load(infile,
object_pairs_hook=collections.OrderedDict)
except ValueError as e:
raise SystemExit(e)
raise SystemExit(e) from None
Copy link
Contributor

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.

Copy link
Member Author

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.

@rhettinger
Copy link
Contributor

Except for the one noted in the comment, these all look good.

@codecov
Copy link

codecov bot commented Apr 5, 2017

Codecov Report

Merging #569 into master will increase coverage by 0.03%.
The diff coverage is 48.64%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
Lib/pickle.py 63.18% <ø> (ø) ⬆️
Lib/asyncio/base_events.py 88.31% <ø> (ø) ⬆️
Lib/difflib.py 86.99% <ø> (ø) ⬆️
Lib/copyreg.py 75.96% <ø> (ø) ⬆️
Lib/xml/dom/xmlbuilder.py 3.5% <ø> (ø) ⬆️
Lib/lib2to3/patcomp.py 88.72% <0%> (ø) ⬆️
Lib/lib2to3/pgen2/literals.py 46.15% <0%> (ø) ⬆️
Lib/nntplib.py 81.57% <0%> (+0.35%) ⬆️
Lib/multiprocessing/context.py 10.44% <0%> (ø) ⬆️
Lib/xml/etree/ElementPath.py 86.84% <0%> (ø) ⬆️
... and 125 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 43ba886...455b509. Read the comment docs.

@serhiy-storchaka serhiy-storchaka merged commit 5affd23 into python:master Apr 5, 2017
@serhiy-storchaka serhiy-storchaka deleted the bpo-29762-raise-from-none branch April 5, 2017 06:37
@serhiy-storchaka
Copy link
Member Author

Thank you for your review @wm75 and @rhettinger.

jaraco pushed a commit that referenced this pull request Dec 2, 2022
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants