[Python-Dev] Is there a reference manual for Python bytecode?

Guido van Rossum gvanrossum at gmail.com
Sun Dec 27 19:41:08 EST 2015


Can you show the diffs you have so far? Somebody's got to look at your code.

--Guido (mobile)
On Dec 27, 2015 16:51, "Erik" <python at lucidity.plus.com> wrote:

> Thanks for your help so far (I'm experimenting with the peephole optimizer
> - hence my question before as I was trying to work out how to know what the
> small integer hard-coded offsets should be when looking ahead in the
> bytecode).
>
>
> I've successfully added a new opcode (generated by the optimizer and
> understood by the interpreter loop) but when adding a second I unexpectedly
> got the following error. I'm not doing anything different to what I did
> with the first opcode as far as I can tell (I have a TARGET(FOO) in ceval.c
> and have obviously defined the new opcode's value in opcode.h).
>
>
> """
> ./python -E -S -m sysconfig --generate-posix-vars ;\
>         if test $? -ne 0 ; then \
>                 echo "generate-posix-vars failed" ; \
>                 rm -f ./pybuilddir.txt ; \
>                 exit 1 ; \
>         fi
> XXX lineno: 241, opcode: 1
> Fatal Python error: Py_Initialize: can't import _frozen_importlib
> Traceback (most recent call last):
>   File "<frozen importlib._bootstrap>", line 698, in <module>
>   File "<frozen importlib._bootstrap>", line 751, in BuiltinImporter
>   File "<frozen importlib._bootstrap>", line 241, in _requires_builtin
> SystemError: unknown opcode
> Aborted (core dumped)
> generate-posix-vars failed
> make: *** [pybuilddir.txt] Error 1
> """
>
> If I #ifdef out the code in peephole.c which generates my new (2nd)
> opcode, then the error does not occur. I tried a "make clean" first, but
> that didn't help (I realise that does not necessarily rule out a makefile
> dependency issue).
>
> Does anyone know if this is a well-known symptom of forgetting to add
> something somewhere when adding a new opcode, or do I need to track it down
> some more myself? I did not have this problem when introducing my first new
> opcode.
>
> Thanks, E.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20151227/72d12fec/attachment.html>


More information about the Python-Dev mailing list