Search
Categories
Documents
Python::Bytecode - Disassemble and investigate Python bytecode (Displayed) README
|
Python::Bytecode - Disassemble and investigate Python bytecode
Python::Bytecode - Disassemble and investigate Python bytecode
use Python::Bytecode
my $bytecode = Python::Bytecode->new($bytecode);
my $bytecode = Python::Bytecode->new(FH);
for ($bytecode->disassemble) {
print $_->[0],"\n"; # Textual representation of disassembly
}
Python::Bytecode accepts a string or filehandle contain Python
bytecode and puts it into a format you can manipulate.
disassemble
-
This is the basic method for getting at the actual code. It returns an
array representing the individual operations in the bytecode stream.
Each element is a reference to a three-element array containing
a textual representation of the disassembly, the opcode number, (the
opname() function can be used to turn this into an op name) and
the argument to the op, if any.
constants
-
This returns an array reflecting the constants table of the bytecode.
Some operations such as
LOAD_CONST refer to constants by index in
this array.
labels
-
Similar to
constants, some operations branch to labels by index
in this table.
varnames
-
Again, when variables are referred to by name, the names are stored
as an index into this table.
filename
-
The filename from which this compiled bytecode is derived.
There are other methods, but you can read the code to find them. It's
not hard, and besides, it's probably easiest to work off the textual
representation of the disassembly anyway.
Simon Cozens, simon@cpan.org
This code is licensed under the same terms as Perl itself.
Information
|
This site is currently in testing, it is not yet operating using the full database. Until it is officially launched you may wish to visit Help-Site Computer Manuals. After launch, this site (HelpSpy) will replace Help-Site. Information about the spider which is currently trawling the Internet looking for links to add to this directory can be found here. |
|
|