changeset 41554:01417ca7f2e2

check-py3-compat: provide filename to ast.parse() This ensures any warning/error messages print a valid filename instead of potentially '<unknown>'. Differential Revision: https://phab.mercurial-scm.org/D5844
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 04 Feb 2019 14:25:00 -0800
parents eb14ab7db33e
children ba7eaff26474
files contrib/check-py3-compat.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-py3-compat.py	Mon Feb 04 14:22:50 2019 -0800
+++ b/contrib/check-py3-compat.py	Mon Feb 04 14:25:00 2019 -0800
@@ -45,7 +45,7 @@
         content = fh.read()
 
     try:
-        ast.parse(content)
+        ast.parse(content, filename=f)
     except SyntaxError as e:
         print('%s: invalid syntax: %s' % (f, e))
         return