From e214baa2098bcce7734ad8852401443fe697200c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sun, 4 Feb 2001 22:37:56 +0000 Subject: [PATCH] Fix binfmt_register documentation to always register the right magic. --- Misc/NEWS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index e17e6560f6b..cf4e6e36b65 100644 --- 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)).