diff --git a/py/_testing/check_compile.py b/py/_testing/check_compile.py index c982babbf..df191d6b4 100644 --- a/py/_testing/check_compile.py +++ b/py/_testing/check_compile.py @@ -1,10 +1,13 @@ import sys -fn = sys.argv[1] -print("Testing %s" % (fn,)) -fp = open(fn, "rb") -try: - source = fp.read() -finally: - fp.close() -compile(source, fn, "exec") +def main(fn): + print("Testing %s" % (fn,)) + fp = open(fn, "rb") + try: + source = fp.read() + finally: + fp.close() + compile(source, fn, "exec") + +if __name__ == "__main__": + main(sys.argv[1])