From: Sjoerd Mullender Date: Wed, 19 Jul 1995 11:21:47 +0000 (+0000) Subject: Get magic number from interpreter (using module imp). X-Git-Tag: v1.3b1~168 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2e5168c9fce4b4ce876feb6999bad5e5fa411afb;p=thirdparty%2FPython%2Fcpython.git Get magic number from interpreter (using module imp). --- diff --git a/Lib/py_compile.py b/Lib/py_compile.py index e0375ea935e8..3c2809b0005a 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()