summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-04-05 06:37:24 (GMT)
committerGitHub <noreply@github.com>2017-04-05 06:37:24 (GMT)
commit5affd23e6f42125998724787025080a24839266e (patch)
tree8b7ca82362e78a32805b117d574082d512251d3c /Lib/pickle.py
parent43ba8861e0ad044efafa46a7cc04e12ac5df640e (diff)
downloadcpython-5affd23e6f42125998724787025080a24839266e.zip
cpython-5affd23e6f42125998724787025080a24839266e.tar.gz
cpython-5affd23e6f42125998724787025080a24839266e.tar.bz2
bpo-29762: More use "raise from None". (#569)
This hides unwanted implementation details from tracebacks.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 702b0b3..faa8fd7 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -269,7 +269,7 @@ def _getattribute(obj, name):
obj = getattr(obj, subpath)
except AttributeError:
raise AttributeError("Can't get attribute {!r} on {!r}"
- .format(name, obj))
+ .format(name, obj)) from None
return obj, parent
def whichmodule(obj, name):
@@ -919,7 +919,7 @@ class _Pickler:
except (ImportError, KeyError, AttributeError):
raise PicklingError(
"Can't pickle %r: it's not found as %s.%s" %
- (obj, module_name, name))
+ (obj, module_name, name)) from None
else:
if obj2 is not obj:
raise PicklingError(
@@ -964,7 +964,7 @@ class _Pickler:
except UnicodeEncodeError:
raise PicklingError(
"can't pickle global identifier '%s.%s' using "
- "pickle protocol %i" % (module, name, self.proto))
+ "pickle protocol %i" % (module, name, self.proto)) from None
self.memoize(obj)