diff options
author | Guido van Rossum <guido@python.org> | 1997-11-26 15:44:34 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-11-26 15:44:34 (GMT) |
commit | 0b23348aa944dcb97c84b34d399c857f039e5773 (patch) | |
tree | 88178b09c8a16b93ab1ab174df968a61d36e7293 /Lib/dos-8x3/py_compi.py | |
parent | 330c660f66243094e082500bc1d760b2b86024cb (diff) | |
download | cpython-0b23348aa944dcb97c84b34d399c857f039e5773.zip cpython-0b23348aa944dcb97c84b34d399c857f039e5773.tar.gz cpython-0b23348aa944dcb97c84b34d399c857f039e5773.tar.bz2 |
The usual
Diffstat (limited to 'Lib/dos-8x3/py_compi.py')
-rwxr-xr-x | Lib/dos-8x3/py_compi.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/dos-8x3/py_compi.py b/Lib/dos-8x3/py_compi.py index e9e90ff..1adc3a2 100755 --- a/Lib/dos-8x3/py_compi.py +++ b/Lib/dos-8x3/py_compi.py @@ -14,16 +14,22 @@ def wr_long(f, x): def compile(file, cfile = None): import os, marshal, __builtin__ f = open(file) + try: + timestamp = os.fstat(file.fileno()) + except AttributeError: + timestamp = long(os.stat(file)[8]) codestring = f.read() f.close() - timestamp = long(os.stat(file)[8]) codeobject = __builtin__.compile(codestring, file, 'exec') if not cfile: cfile = file + (__debug__ and 'c' or 'o') fc = open(cfile, 'wb') - fc.write(MAGIC) + fc.write('\0\0\0\0') wr_long(fc, timestamp) marshal.dump(codeobject, fc) + fc.flush() + fc.seek(0, 0) + fc.write(MAGIC) fc.close() if os.name == 'mac': import macfs |