summaryrefslogtreecommitdiff
path: root/Lib/codeop.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/codeop.py')
-rw-r--r--Lib/codeop.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/codeop.py b/Lib/codeop.py
index fc7e1e70ce..082285f94f 100644
--- a/Lib/codeop.py
+++ b/Lib/codeop.py
@@ -93,10 +93,13 @@ def _maybe_compile(compiler, source, filename, symbol):
except SyntaxError as e:
err2 = e
- if code:
- return code
- if not code1 and repr(err1) == repr(err2):
- raise err1
+ try:
+ if code:
+ return code
+ if not code1 and repr(err1) == repr(err2):
+ raise err1
+ finally:
+ err1 = err2 = None
def _compile(source, filename, symbol):
return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT)