summaryrefslogtreecommitdiffstats
path: root/Lib/json
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/json
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/json')
-rw-r--r--Lib/json/decoder.py3
-rw-r--r--Lib/json/scanner.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py
index 2422c6a..3741dee 100644
--- a/Lib/json/decoder.py
+++ b/Lib/json/decoder.py
@@ -103,7 +103,8 @@ def py_scanstring(s, end, strict=True,
try:
esc = s[end]
except IndexError:
- raise JSONDecodeError("Unterminated string starting at", s, begin)
+ raise JSONDecodeError("Unterminated string starting at",
+ s, begin) from None
# If not a unicode escape sequence, must be in the lookup table
if esc != 'u':
try:
diff --git a/Lib/json/scanner.py b/Lib/json/scanner.py
index 86426cd..c451eba 100644
--- a/Lib/json/scanner.py
+++ b/Lib/json/scanner.py
@@ -29,7 +29,7 @@ def py_make_scanner(context):
try:
nextchar = string[idx]
except IndexError:
- raise StopIteration(idx)
+ raise StopIteration(idx) from None
if nextchar == '"':
return parse_string(string, idx + 1, strict)