[prev in list] [next in list] [prev in thread] [next in thread]
List: pypy-svn
Subject: [pypy-commit] pypy release-2.1.x: Change the magic number in .pyc files: we used default_magic = 0xf
From: arigo <noreply () buildbot ! pypy ! org>
Date: 2013-07-30 18:44:56
Message-ID: 20130730184456.E8EAC1C00D8 () cobra ! cs ! uni-duesseldorf ! de
[Download RAW message or body]
Author: Armin Rigo <arigo@tunes.org>
Branch: release-2.1.x
Changeset: r65825:43efd6376dab
Date: 2013-07-30 20:42 +0200
http://bitbucket.org/pypy/pypy/changeset/43efd6376dab/
Log: Change the magic number in .pyc files: we used default_magic =
0xf303+2, now it is 0xf303+6. The most recent incompatible change
that requires this change is e953dfbc7f0a.
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -31,7 +31,7 @@
# Magic numbers for the bytecode version in code objects.
# See comments in pypy/module/imp/importing.
cpython_magic, = struct.unpack("<i", imp.get_magic()) # host magic number
-default_magic = (168686339+2) | 0x0a0d0000 # this PyPy's magic
+default_magic = (0xf303 + 6) | 0x0a0d0000 # this PyPy's magic
# (from CPython 2.7.0)
# cpython_code_signature helper
diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -833,21 +833,16 @@
"""
# picking a magic number is a mess. So far it works because we
-# have only one extra opcode, which bumps the magic number by +2, and CPython
-# leaves a gap of 10 when it increases
-# its own magic number. To avoid assigning exactly the same numbers
-# as CPython we always add a +2. We'll have to think again when we
-# get three more new opcodes
+# have only one extra opcode which might or might not be present.
+# CPython leaves a gap of 10 when it increases its own magic number.
+# To avoid assigning exactly the same numbers as CPython, we can pick
+# any number between CPython + 2 and CPython + 9. Right now,
+# default_magic = CPython + 6.
#
-# * CALL_METHOD +2
-#
-# In other words:
-#
-# default_magic -- used by CPython without the -U option
-# default_magic + 1 -- used by CPython with the -U option
-# default_magic + 2 -- used by PyPy without any extra opcode
-# ...
-# default_magic + 5 -- used by PyPy with both extra opcodes
+# default_magic - 6 -- used by CPython without the -U option
+# default_magic - 5 -- used by CPython with the -U option
+# default_magic -- used by PyPy without the CALL_METHOD opcode
+# default_magic + 2 -- used by PyPy with the CALL_METHOD opcode
#
from pypy.interpreter.pycode import default_magic
MARSHAL_VERSION_FOR_PYC = 2
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic