byterun
byterun copied to clipboard
Add Py3.4 support.
With these patches the tests pass in Py3.4. This isn't done yet because I had to reimplement __build_class__, and that reimplementation doesn't yet support metaclasses or closures. It looks like the closure support will need to share a fix with issue #17, so I'm going to take a look at that next. I'm just opening this pull request now to let you know what's up -- maybe I should've opened an issue instead?
Another idea could be to wrap the built-in __build_class__ primitive, passing it a Python function object for which it'd do the right thing, but __build_class__ is magical enough that that seems difficult.
There are also fixes for a couple of other problems that came up in running the tests in 3.4.
(I haven't tested 3.5 or 3.6, or 3.3 yet either. It does still pass the tests in 2.7.)
My motivation is to get my Python bytecode compiler https://github.com/darius/500lines/blob/master/bytecode-compiler/bytecompiler.rewrite.md to run on top of a bytecode interpreter also in Python. My compiler's for Py3.4 only.
@darius: I'm unlikely to do more work on byterun, so maybe we should find another owner...
I guess I could volunteer, though I'd rather someone else owned it, like you or @akaptur. My intent for this work here was to make a cut-down version of byterun for just py3.4 and the bytecodes that my compiler uses, so people could more easily read the whole thing. I just figured it's more sensible/helpful to do the porting work first on the real byterun.
I also ported a half-dozen tests for metaclass logic over from CPython 3.4's test_metaclass.py (they're all passing). They're not checked in yet because I guess we'd need to add the CPython license terms to LICENSE and I don't really understand those legalities. Besides that, and making sure my fix for #17 follows the CPython logic, I think this is done. I'm going to get on with my subset, but let me know if it'd help to clean this up somehow, check in the new tests, etc.
Oh, and I still need to install 3.3 and make sure that's still passing.