-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Changes from 1 commit
882345c
5549a66
d0fb06f
455b509
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 |
||
with outfile: | ||
json.dump(obj, outfile, sort_keys=sort_keys, indent=4) | ||
outfile.write('\n') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
# Whether each message must end in a newline | ||
_append_newline = False | ||
|
@@ -555,7 +555,7 @@ def _lookup(self, key): | |
try: | ||
return self._toc[key] | ||
except KeyError: | ||
raise KeyError('No message with key: %s' % key) | ||
raise KeyError('No message with key: %s' % key) from None | ||
|
||
# This method is for backward compatibility only. | ||
def next(self): | ||
|
@@ -741,7 +741,7 @@ def _lookup(self, key=None): | |
try: | ||
return self._toc[key] | ||
except KeyError: | ||
raise KeyError('No message with key: %s' % key) | ||
raise KeyError('No message with key: %s' % key) from None | ||
|
||
def _append_message(self, message): | ||
"""Append message to mailbox and return (start, stop) offsets.""" | ||
|
@@ -1572,7 +1572,7 @@ def set_date(self, date): | |
try: | ||
self._date = float(date) | ||
except ValueError: | ||
raise TypeError("can't convert to float: %s" % date) | ||
raise TypeError("can't convert to float: %s" % date) from None | ||
|
||
def get_info(self): | ||
"""Get the message's "info" as a string.""" | ||
|
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.