Skip to content

Commit f5a81c2

Browse files
author
Russell
committed
Added special case to avoid double printing SyntaxError expression.
1 parent 818dad8 commit f5a81c2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pythonpy/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def format(output):
190190

191191
if args.post_cmd:
192192
exec(args.post_cmd)
193-
except Exception:
193+
except Exception as ex:
194194
import traceback
195195
pyheader = 'File "{}"'.format(__file__)
196196
exprheader = 'File "<string>"'
@@ -200,7 +200,7 @@ def format(output):
200200
if line.lstrip().startswith(pyheader):
201201
continue
202202
sys.stderr.write(line)
203-
if not foundexpr and line.lstrip().startswith(exprheader):
203+
if not foundexpr and line.lstrip().startswith(exprheader) and not isinstance(ex, SyntaxError):
204204
sys.stderr.write(' {}\n'.format(args.expression))
205205
foundexpr = True
206206

0 commit comments

Comments
 (0)