-
-
Notifications
You must be signed in to change notification settings - Fork 424
Issue #181: python36 bytecode compatibility (for dicts and others) #536
Conversation
So it turns out I was referring to a quite out-of-date branch of cpython. I'll have to go through my updates all over again 🙃 |
Updated the opcodes to the correct list for CPython 3.6. The next two actions are to (a) deal with 16bit opcodes, and (b) implement the new, empty, opcode handlers. This issue from b.p.o. explains in quite a lot of detail the rationale behind having 16-bit opcodes. |
Hi @cjrh I'm running this against 3.6.1 in https://circleci.com/gh/pybee/batavia/834 (against the topic/cjrh-issue-181-bytecode-python36 branch). Let's see how this goes! Specifically, I had to change the circleci config. |
@glasnt Excellent, thanks! |
For convenience, I'm duplicating the link to the 16-bit opcode change in CPython, here. |
@cjrh there are a bunch of issues that the CI tests picked up. Take a look at the results and see what happened. |
Doing a spot-check on this test: In the scenario I'm looking at, the input code is:
So, the py_out is
while the js_out is
Now I'm no batavia expert, but it seems to me that the correct I expect such differences probably account for many of the failed tests in this PR right now. |
The regex for doing
This will need to be changed too (for |
Following discussion with @freakboy3742, it seems that the js_out above is incorrect, since the exception should be getting handled and a traceback should not be printed. This must be a regression introduced by the changes in this PR, so this must be investigated. |
Testing this code snippet:
Produces the correct output in the Batavia testbed in the browser. Continuing to look for why the tests are different. |
I'm going to refactor the |
I may have successfully convinced @bspink to have a look at this too! |
@cjrh Yes, he did. There are still some test failures due to message format, but those exist on 3.5 as well; so I'm going close this ticket. Thanks for your work on this, even though it didn't end up being merged! |
This PR is still a WIP for discussion, since several details still need to be addressed:
Note that this PR also includes implementations for the
__matmul__
and__imatmul__
methods for theBINARY_MATRIX_MULTIPLY
andINPLACE_MATRIX_MULTIPLY
special methods. These changes are not required for 3.6 compat but they were easy to add. They can be moved into a separate PR if desired.Another subtlety: the
WITH_CLEANUP
bytecode name is now, at least in 3.6, separated intoWITH_CLEANUP_START
andWITH_CLEANUP_END
and so I've changed these indis.js
. The Batavia code handling this opcode in the VM code is currently commented out, so I've gone ahead and changedWITH_CLEANUP
intoWITH_CLEANUP_START
inside the commented-out code.Before too much more work is done, we should discuss whether this is the right approach or not.