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

2015-12-29 Thread Wes Turner
numba * http://numba.pydata.org/numba-doc/0.16.0/modules/numba.html#module-numba.bytecode * https://github.com/numba/numba/blob/master/numba/bytecode.py pypy * http://doc.pypy.org/en/latest/interpreter.html * http://aosabook.org/en/pypy.html ... http://compilers.pydata.org/ #Bytecode Utilities

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

2015-12-29 Thread Erik
Hi Nick, On 29/12/15 02:46, Nick Coghlan wrote: 1. The interpreter's bytecode generation is inconsistent with the implementation of the eval loop Essentially, this was my problem. I'd neglected to add the reference to TARGET_NEW_OP2 to Python/opcode_targets.h (so staring hard at the op

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

2015-12-28 Thread Sturla Molden
Brett Cannon wrote: > Ned also neglected to mention his byterun project which is a pure Python > implementation of the CPython eval loop: href="https://github.com/nedbat/byterun;>https://github.com/nedbat/byterun I would also encourage you to take a look at Numba. It is an

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

2015-12-28 Thread Nick Coghlan
On 28 December 2015 at 11:00, Erik wrote: > On 28/12/15 00:41, Guido van Rossum wrote: >> >> Can you show the diffs you have so far? Somebody's got to look at your >> code. > > Sounds like it's not a well-known symptom then. The symptom is well known (at least to folks

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

2015-12-27 Thread Ned Batchelder
On 12/26/15 10:19 PM, Nick Coghlan wrote: On 27 December 2015 at 12:23, Guido van Rossum wrote: On Sat, Dec 26, 2015 at 6:06 PM, Brett Cannon wrote: Ned also neglected to mention his byterun project which is a pure Python implementation of the CPython

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

2015-12-27 Thread Erik
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

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

2015-12-27 Thread Brett Cannon
You can look at https://docs.python.org/devguide/compiler.html to see if you missed something. As for the _frozen_importlib problem, that typically manifests itself when you have invalid bytecode (that module is frozen bytecode that gets compiled into the interpreter and is the first bit of

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

2015-12-27 Thread Guido van Rossum
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" 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

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

2015-12-27 Thread Erik
On 28/12/15 00:41, Guido van Rossum wrote: Can you show the diffs you have so far? Somebody's got to look at your code. Sounds like it's not a well-known symptom then. I agree, but that Somebody should be me (initially, at least) - I don't want to waste other people's time if I made a silly

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

2015-12-26 Thread Erik
Hi Joe, On 26/12/15 22:36, Joe Jevnik wrote: The number and meaning of the arguments are documented in the dis module: https://docs.python.org/3.6/library/dis.html OK - I *did* find that, but perhaps didn't immediately understand what it was telling me. So, something documented as

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

2015-12-26 Thread Erik
Hi. Looking at ceval.c and peephole.c, there is - of course - lots of specific hard-coded knowledge of the bytecode (e.g., number of operands and other attributes). I'd like to experiment at this level, but I can't seem to find a reference for the bytecode. Is there the equivalent of

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

2015-12-26 Thread Guido van Rossum
On Sat, Dec 26, 2015 at 6:06 PM, Brett Cannon wrote: > Ned also neglected to mention his byterun project which is a pure Python > implementation of the CPython eval loop: https://github.com/nedbat/byterun > >From the commit log it looks like it's a co-production between Ned and

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

2015-12-26 Thread Joe Jevnik
The number and meaning of the arguments are documented in the dis module: https://docs.python.org/3.6/library/dis.html On Sat, Dec 26, 2015 at 5:20 PM, Erik wrote: > Hi. > > Looking at ceval.c and peephole.c, there is - of course - lots of specific > hard-coded

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

2015-12-26 Thread Guido van Rossum
Also there's a great talk by Allison Kaptur on YouTube about this topic: https://www.youtube.com/watch?v=HVUTjQzESeo -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org

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

2015-12-26 Thread Ned Batchelder
On 12/26/15 6:13 PM, Erik wrote: On 26/12/15 23:10, Joe Jevnik wrote: All arguments are 2 bytes, if there needs to be more, EXTENDED_ARG is used OK, got it - many thanks. One thing to understand that may not be immediately apparent: the byte code can (and does) change between versions, so

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

2015-12-26 Thread Erik
On 26/12/15 23:10, Joe Jevnik wrote: All arguments are 2 bytes, if there needs to be more, EXTENDED_ARG is used OK, got it - many thanks. E. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev

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

2015-12-26 Thread Brett Cannon
Ned also neglected to mention his byterun project which is a pure Python implementation of the CPython eval loop: https://github.com/nedbat/byterun On Sat, 26 Dec 2015, 16:38 Ned Batchelder wrote: > On 12/26/15 6:13 PM, Erik wrote: > > On 26/12/15 23:10, Joe Jevnik

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

2015-12-26 Thread Joe Jevnik
All arguments are 2 bytes, if there needs to be more, EXTENDED_ARG is used On Sat, Dec 26, 2015 at 5:51 PM, Erik wrote: > Hi Joe, > > On 26/12/15 22:36, Joe Jevnik wrote: > >> The number and meaning of the arguments are documented in the dis >> module:

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

2015-12-26 Thread Nick Coghlan
On 27 December 2015 at 12:23, Guido van Rossum wrote: > On Sat, Dec 26, 2015 at 6:06 PM, Brett Cannon wrote: >> >> Ned also neglected to mention his byterun project which is a pure Python >> implementation of the CPython eval loop: