Reference

class codemach.Machine(verbose=False, callbacks={})[source]

Class that executes python code objects.

Parameters:verbose – verbosity level
build_class(callable_, args)[source]

Implement builtins.__build_class__. We must wrap all class member functions using function_wrapper(). This requires using a Machine to execute the class source code and then recreating the class source code using an Assembler.

call_function(i)[source]

Implement the CALL_FUNCTION operation.

exec(code, globals_=None, _locals=None)[source]

Execute a code object

The inputs and behavior of this function should match those of eval and exec.

Note

Need to figure out how the internals of this function must change for eval or exec.

Parameters:
  • code – a python code object
  • globals – optional globals dictionary
  • _locals – optional locals dictionary
load_name(name)[source]

Implementation of the LOAD_NAME operation

pop(n)[source]

Pop the n topmost items from the stack and return them as a list.

store_name(name, val)[source]

Implementation of the STORE_NAME operation