diff --git a/Lib/py_compile.py b/Lib/py_compile.py index e0375ea935e..3c2809b0005 100644 --- a/Lib/py_compile.py +++ b/Lib/py_compile.py @@ -2,7 +2,8 @@ # This has intimate knowledge of how Python/import.c does it. # By Sjoerd Mullender (I forced him to write it :-). -MAGIC = 0x999903 +import imp +MAGIC = imp.get_magic() def wr_long(f, x): f.write(chr( x & 0xff)) @@ -20,7 +21,7 @@ def compile(file, cfile = None): if not cfile: cfile = file + 'c' fc = open(cfile, 'wb') - wr_long(fc, MAGIC) + fc.write(MAGIC) wr_long(fc, timestamp) marshal.dump(codeobject, fc) fc.close()