diff options
author | Guido van Rossum <guido@python.org> | 1998-10-02 01:23:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-10-02 01:23:47 (GMT) |
commit | 64e736ba4e8c7d706f705e1e34a24f8e24d285d6 (patch) | |
tree | a097506524d3530d65427918ce01171bb5ac2e8d /Lib/dos-8x3/py_compi.py | |
parent | fdb8fb8b312bb9814bca5c153c8246fed2156c81 (diff) | |
download | cpython-64e736ba4e8c7d706f705e1e34a24f8e24d285d6.zip cpython-64e736ba4e8c7d706f705e1e34a24f8e24d285d6.tar.gz cpython-64e736ba4e8c7d706f705e1e34a24f8e24d285d6.tar.bz2 |
Some new blood and some updated versions.
Diffstat (limited to 'Lib/dos-8x3/py_compi.py')
-rwxr-xr-x | Lib/dos-8x3/py_compi.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/dos-8x3/py_compi.py b/Lib/dos-8x3/py_compi.py index 98b3b21..a6d03d7 100755 --- a/Lib/dos-8x3/py_compi.py +++ b/Lib/dos-8x3/py_compi.py @@ -51,7 +51,15 @@ def compile(file, cfile=None, dfile=None): f.close() if codestring and codestring[-1] != '\n': codestring = codestring + '\n' - codeobject = __builtin__.compile(codestring, dfile or file, 'exec') + try: + codeobject = __builtin__.compile(codestring, dfile or file, 'exec') + except SyntaxError, detail: + import traceback, sys, string + lines = traceback.format_exception_only(SyntaxError, detail) + for line in lines: + sys.stderr.write(string.replace(line, 'File "<string>"', + 'File "%s"' % (dfile or file))) + return if not cfile: cfile = file + (__debug__ and 'c' or 'o') fc = open(cfile, 'wb') |