Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1853)

Unified Diff: python/safeeval.py

Issue 553420043: Switch to Python 3.x (Closed)
Patch Set: Remove coverage.py Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « python/rational.py ('k') | python/utilities.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: python/safeeval.py
diff --git a/python/safeeval.py b/python/safeeval.py
index 41076200ddb8da397a1004ec196145db7a1dc06e..7fa2627a0124243f9a974105de3f992045dac744 100644
--- a/python/safeeval.py
+++ b/python/safeeval.py
@@ -58,11 +58,11 @@ def safe_eval(source, fail_on_error = True):
walker = fail_on_error and SafeEvalWithErrors() or SafeEval()
try:
ast = compiler.parse(source,"eval")
- except SyntaxError, err:
+ except SyntaxError as err:
raise
try:
return walker.visit(ast)
- except Unsafe_Source_Error, err:
+ except Unsafe_Source_Error as err:
raise
@@ -70,15 +70,15 @@ def safe_eval(source, fail_on_error = True):
walker = fail_on_error and SafeEvalWithErrors() or SafeEval()
try:
ast = compiler.parse(source,"eval")
- except SyntaxError, err:
+ except SyntaxError as err:
raise
try:
return walker.visit(ast)
- except Unsafe_Source_Error, err:
+ except Unsafe_Source_Error as err:
raise
def test ():
- print safe_eval ('{1: [2,3], "4": (-1,2)}')
+ print(safe_eval ('{1: [2,3], "4": (-1,2)}'))
if __name__ == '__main__':
test ()
« no previous file with comments | « python/rational.py ('k') | python/utilities.py » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b