Table of Contents

Module: Code ./src/peak/util/Code.py

Bytecode inspection and patching - like a simpler (faster!) bytecodehacks

Similar to the Python bytecodehacks package, this module supplies Code and Function objects which are mutable versions of the real things. The main difference between this module and bytecodehacks is that this module values speed above nearly all other considerations, and thus only offers in-place bytecode patching, and eschews most of the higher-level facilities offered by bytecodehacks. But it's plenty enough for what PEAK needs.

The module makes available many useful values; you can get any opcode as a constant from it by explicit import, such as:

        from peak.util.Code import LOAD_NAME, STORE_NAME

There's also an opcode array that you can import that maps opcode names to values.

Imported modules   
from array import array
from dis import HAVE_ARGUMENT, EXTENDED_ARG, opname
import new
from types import CodeType
Functions   
_bindAll
bind_func
copy_func
  _bindAll 
_bindAll ( f )

  bind_func 
bind_func ( func,  **kw )

  copy_func 
copy_func ( func )

Classes   

Code

Editable version of Python code objects

Function

Editable version of Python function objects; includes code editing

FunctionBinder

codeIndex

Useful indexes over a code object

codeIter

Iterator for stepping through bytecode


Table of Contents

This document was automatically generated on Mon Apr 15 01:11:04 2024 by HappyDoc version 2.1