mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-29762: More use "raise from None". (#569)
This hides unwanted implementation details from tracebacks.
This commit is contained in:
parent
43ba8861e0
commit
5affd23e6f
30 changed files with 50 additions and 48 deletions
|
@ -786,7 +786,7 @@ def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0,
|
|||
try:
|
||||
format_info = _ARCHIVE_FORMATS[format]
|
||||
except KeyError:
|
||||
raise ValueError("unknown archive format '%s'" % format)
|
||||
raise ValueError("unknown archive format '%s'" % format) from None
|
||||
|
||||
func = format_info[0]
|
||||
for arg, val in format_info[1]:
|
||||
|
@ -962,7 +962,7 @@ def unpack_archive(filename, extract_dir=None, format=None):
|
|||
try:
|
||||
format_info = _UNPACK_FORMATS[format]
|
||||
except KeyError:
|
||||
raise ValueError("Unknown unpack format '{0}'".format(format))
|
||||
raise ValueError("Unknown unpack format '{0}'".format(format)) from None
|
||||
|
||||
func = format_info[1]
|
||||
func(filename, extract_dir, **dict(format_info[2]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue