bpo-29762: More use "raise from None". (#569)
This hides unwanted implementation details from tracebacks.
diff --git a/Lib/lib2to3/pgen2/literals.py b/Lib/lib2to3/pgen2/literals.py
index 4f50d31..b9b63e6 100644
--- a/Lib/lib2to3/pgen2/literals.py
+++ b/Lib/lib2to3/pgen2/literals.py
@@ -29,12 +29,12 @@
try:
i = int(hexes, 16)
except ValueError:
- raise ValueError("invalid hex string escape ('\\%s')" % tail)
+ raise ValueError("invalid hex string escape ('\\%s')" % tail) from None
else:
try:
i = int(tail, 8)
except ValueError:
- raise ValueError("invalid octal string escape ('\\%s')" % tail)
+ raise ValueError("invalid octal string escape ('\\%s')" % tail) from None
return chr(i)
def evalString(s):