From 8803fad991c868d5ca3c0b10cda0201bbd6f0176 Mon Sep 17 00:00:00 2001 From: Florian Best Date: Thu, 14 Mar 2024 01:01:17 +0100 Subject: [PATCH] feat: display concrete SyntaxError (#60) otherwise only the filename is shown but not the concrete line number. --- src/com2ann.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com2ann.py b/src/com2ann.py index f6d0f48..28f9572 100644 --- a/src/com2ann.py +++ b/src/com2ann.py @@ -772,7 +772,8 @@ def com2ann(code: str, *, tree = ast.parse(code, type_comments=True, feature_version=(3, python_minor_version)) - except SyntaxError: + except SyntaxError as exc: + print("SyntaxError:", exc, file=sys.stderr) return None lines = code.splitlines(keepends=True) rl = BytesIO(code.encode('utf-8')).readline