diff options
Diffstat (limited to 'Lib/py_compile.py')
-rw-r--r-- | Lib/py_compile.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/py_compile.py b/Lib/py_compile.py index ed54f47..98c5db0 100644 --- a/Lib/py_compile.py +++ b/Lib/py_compile.py @@ -14,12 +14,17 @@ def compile(file, cfile = None): import os, marshal, __builtin__ f = open(file) codestring = f.read() - timestamp = os.fstat(f.fileno())[8] f.close() + timestamp = os.stat(file)[8] codeobject = __builtin__.compile(codestring, file, 'exec') if not cfile: cfile = file + 'c' - fc = open(cfile, 'w') + fc = open(cfile, 'wb') wr_long(fc, MAGIC) wr_long(fc, timestamp) marshal.dump(codeobject, fc) + fc.close() + if os.name == 'mac': + import MacOS + MacOS.SetFileType(cfile, 'PYC ', 'PYTH') + MacOS.SetFileType(file, 'TEXT', 'PYTH') |