https://wiki.python.org/moin/ByteplayDoc
A more modern API is being developed @ https://github.com/vstinner/bytecode
face Python bytecode metaprogramming API fork
Home Page: http://code.google.com/p/byteplay
License: GNU Lesser General Public License v2.1
https://wiki.python.org/moin/ByteplayDoc
A more modern API is being developed @ https://github.com/vstinner/bytecode
I encountered the 'closed' issue reported by @pwaller with Python 3.4. Stack size computation is broken (method '_compute_stacksize') and returns zero for every block of code I tried. As I mentioned in comment of original issue I tried to fix it (peterazmanov/byteplay). My changes stopped crashes, but the code requires further testing.
The dis
package has beed changed in Python 3.5: https://docs.python.org/3.5/library/dis.html
WITH_CLEANUP
is now split into WITH_CLEANUP_START
and WITH_CLEANUP_FINISH
, hence byteplay can't be imported without a NameError
in Python 3.5.
I haven't tested the py3 version, but on python 2, this breaks the stack size computation and results in a segmentation fault or an assertion failure if you happen to be running debug python.
The following code prints old stacksize = 2, new stacksize = 0, and then crashes.
def rebuild_function():
import byteplay as B
c = B.Code.from_code(func.func_code)
code = c.to_code()
args = code, func.func_globals, func.func_name, func.func_defaults, func.func_closure
return types.FunctionType(*args)
def testfunc():
return VALUE, ANOTHER
newfunc = rebuild_function(testfunc)
print "Orig stacksize: ", testfunc.func_code.co_stacksize
print "New stacksize: ", newfunc.func_code.co_stacksize
# crashes
newfunc()
Running the 2to3 tool resulted in this addition:
if jump>0xFFFF:raise NotImplementedError,"Extended jumps not implemented"
if jump>0xFFFF:raise NotImplementedError("Extended jumps not implemented")
There were other changes it recommended, but this was the minimum necessary to get byteplay to be able to import without throwing an error.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.