]> granicus.if.org Git - python/commitdiff
Fix binfmt_register documentation to always register the right magic.
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 4 Feb 2001 22:37:56 +0000 (22:37 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 4 Feb 2001 22:37:56 +0000 (22:37 +0000)
Misc/NEWS

index e17e6560f6b02b2c95fca09f666edce83fa38cf5..cf4e6e36b6543f2db80f5577498bcc2a5067dd6f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -259,7 +259,10 @@ Core language, builtins, and interpreter
 - The interpreter accepts now bytecode files on the command line even
   if they do not have a .pyc or .pyo extension. On Linux, after executing
 
-  echo ':pyc:M::\x87\xc6\x0d\x0a::/usr/local/bin/python:' > /proc/sys/fs/binfmt_misc/register
+import imp,sys,string
+magic = string.join(["\\x%.2x" % ord(c) for c in imp.get_magic()],"")
+reg = ':pyc:M::%s::%s:' % (magic, sys.executable)
+open("/proc/sys/fs/binfmt_misc/register","wb").write(reg)
 
   any byte code file can be used as an executable (i.e. as an argument
   to execve(2)).