diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-01-15 11:51:06 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-01-15 11:51:06 (GMT) |
commit | 0c6774d92b48c4c4097a3a3bea2294093092e4e3 (patch) | |
tree | 99fca658cecaee2a9ec1d8bff51357bc8e61c504 /Lib/compileall.py | |
parent | d69663d3009b6718ed3fa27dec800d15c7d4babb (diff) | |
download | cpython-0c6774d92b48c4c4097a3a3bea2294093092e4e3.zip cpython-0c6774d92b48c4c4097a3a3bea2294093092e4e3.tar.gz cpython-0c6774d92b48c4c4097a3a3bea2294093092e4e3.tar.bz2 |
Patch #661719: Expose compilation errors as exceptions on request.
Diffstat (limited to 'Lib/compileall.py')
-rw-r--r-- | Lib/compileall.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Lib/compileall.py b/Lib/compileall.py index 8397c96..0f4010f 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -62,16 +62,11 @@ def compile_dir(dir, maxlevels=10, ddir=None, if not quiet: print 'Compiling', fullname, '...' try: - ok = py_compile.compile(fullname, None, dfile) + ok = py_compile.compile(fullname, None, dfile, True) except KeyboardInterrupt: raise KeyboardInterrupt - except: - # XXX py_compile catches SyntaxErrors - if type(sys.exc_type) == type(''): - exc_type_name = sys.exc_type - else: exc_type_name = sys.exc_type.__name__ - print 'Sorry:', exc_type_name + ':', - print sys.exc_value + except py_compile.PyCompileError,err: + print err.msg success = 0 else: if ok == 0: |