]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Get magic number from interpreter (using module imp).
authorSjoerd Mullender <sjoerd@acm.org>
Wed, 19 Jul 1995 11:21:47 +0000 (11:21 +0000)
committerSjoerd Mullender <sjoerd@acm.org>
Wed, 19 Jul 1995 11:21:47 +0000 (11:21 +0000)
Lib/py_compile.py

index e0375ea935e85961e4b9b3b9f3c7fe32c33e86f0..3c2809b0005a460566189403bf4d902f1fd670dc 100644 (file)
@@ -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()