We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8700fe6 commit e6c128fCopy full SHA for e6c128f
Lib/py_compile.py
@@ -14,16 +14,22 @@ def wr_long(f, x):
14
def compile(file, cfile = None):
15
import os, marshal, __builtin__
16
f = open(file)
17
+ try:
18
+ timestamp = os.fstat(file.fileno())
19
+ except AttributeError:
20
+ timestamp = long(os.stat(file)[8])
21
codestring = f.read()
22
f.close()
- timestamp = long(os.stat(file)[8])
23
codeobject = __builtin__.compile(codestring, file, 'exec')
24
if not cfile:
25
cfile = file + (__debug__ and 'c' or 'o')
26
fc = open(cfile, 'wb')
- fc.write(MAGIC)
27
+ fc.write('\0\0\0\0')
28
wr_long(fc, timestamp)
29
marshal.dump(codeobject, fc)
30
+ fc.flush()
31
+ fc.seek(0, 0)
32
+ fc.write(MAGIC)
33
fc.close()
34
if os.name == 'mac':
35
import macfs
0 commit comments