[pypy-dev] Changing the default magic number

Bruno Gola brunogola at gmail.com
Thu Jul 10 16:15:36 CEST 2008


Hi,

On Thu, Jul 10, 2008 at 4:24 AM, Maciej Fijalkowski <fijall at gmail.com> wrote:
> Magic in pyc files and magic as a number for pyopcode are different things IMO.

Yes, in PyPy they are different things. The magic number in .pyc files
compiled by PyPy is 1024. PyPy doesn't try to use .pyc generated by
CPython and CPython will not try to use .pyc generated by PyPy
(because of these magic number).

But the magic I'm talking about is the default value for PyCode magic
attribute. In pycode.py there is comment saying "value for Python
2.4.1" and a default value of 62061 for these attribute. These number
is checked in many cases (or at least two) where, as Armin said,
changes to the semantics of bytecodes have been made.

It seems to me that these default value is always used, I could not
find any place where a PyCode instance is created changing these
value, but I may be wrong. Anyway, the semantics for YIELD_VALUE have
already been changed (in 2.5-features branch) and i think it's good
idea to change the other opcodes that have changed as well.

The magic attribute is checked against the magic value for Python2.5
(and other) some times (probably when the opcode semantics changed and
PyPy wanted to support both semantics) but as the default value is
never changed (as far as I know) I think those checks are not being
useful.

I think we could change these value to the 2.5 one. I think it will
not affect anything (only these opcodes that we are changing as well).

Cheers,
--
Bruno Fialho Marques Gola <brunogola at gmail.com>
http://www.brunogola.com.br
Cel: (11) 9294-5883



More information about the Pypy-dev mailing list