deimos.python.code

Mirror code.h

Members

Functions

PyCode_Addr2Line
int PyCode_Addr2Line(PyCodeObject* , int )

Return the line number associated with the specified bytecode index in this code object. If you just need the line number of a frame, use PyFrame_GetLineNumber() instead.

PyCode_Check
int PyCode_Check(PyObject* op)

_

PyCode_CheckLineNumber
int PyCode_CheckLineNumber(PyCodeObject* co, int lasti, PyAddrPair* bounds)

Check whether lasti (an instruction offset) falls outside bounds and whether it is a line number that should be traced. Returns a line number if it should be traced or -1 if the line should not.

PyCode_GetNumFree
size_t PyCode_GetNumFree(PyObject* op)

_

PyCode_New
PyCodeObject* PyCode_New(int argcount, int nlocals, int stacksize, int flags, PyObject* code, PyObject* consts, PyObject* names, PyObject* varnames, PyObject* freevars, PyObject* cellvars, PyObject* filenames, PyObject* name, int firstlineno, PyObject* lnotab)

_

PyCode_NewEmpty
PyCodeObject* PyCode_NewEmpty(const(char)* filename, const(char)* funcname, int firstlineno)

Creates a new empty code object with the specified source location. Availability: >= 2.7

PyCode_Optimize
PyObject* PyCode_Optimize(PyObject* code, PyObject* consts, PyObject* names, PyObject* lineno_obj)

Availability: >= 2.6

_PyCode_CheckLineNumber
int _PyCode_CheckLineNumber(PyCodeObject* co, int lasti, PyAddrPair* bounds)

Update *bounds to describe the first and one-past-the-last instructions in the same line as lasti. Return the number of that line. Availability: 2.7

Manifest constants

CO_CELL_NOT_AN_ARG
enum CO_CELL_NOT_AN_ARG;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
CO_CELL_NOT_AN_ARG
enum CO_CELL_NOT_AN_ARG;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
CO_FUTURE_ANNOTATIONS
enum CO_FUTURE_ANNOTATIONS;

Availability: 3.7

CO_FUTURE_BARRY_AS_BDFL
enum CO_FUTURE_BARRY_AS_BDFL;

Availability: 3.2

CO_FUTURE_GENERATOR_STOP
enum CO_FUTURE_GENERATOR_STOP;

Availability: 3.5

Structs

PyAddrPair
struct PyAddrPair

_

PyCodeObject
struct PyCodeObject

Bytecode object

Variables

CO_COROUTINE
enum int CO_COROUTINE;

The CO_COROUTINE flag is set for coroutine functions (defined with `async def` keywords)

CO_FUTURE_ABSOLUTE_IMPORT
enum int CO_FUTURE_ABSOLUTE_IMPORT;

do absolute imports by default Availability: >= 2.5

CO_FUTURE_DIVISION
enum int CO_FUTURE_DIVISION;

_

CO_FUTURE_PRINT_FUNCTION
enum int CO_FUTURE_PRINT_FUNCTION;
CO_FUTURE_UNICODE_LITERALS
enum int CO_FUTURE_UNICODE_LITERALS;

Availability: >= 2.5

CO_FUTURE_WITH_STATEMENT
enum int CO_FUTURE_WITH_STATEMENT;

Availability: >= 2.5

CO_GENERATOR
enum int CO_GENERATOR;

Masks for co_flags above

CO_GENERATOR_ALLOWED
enum int CO_GENERATOR_ALLOWED;

Availability: <= 2.5

CO_ITERABLE_COROUTINE
enum int CO_ITERABLE_COROUTINE;

_

CO_MAXBLOCKS
enum int CO_MAXBLOCKS;

Max static block nesting within a function

CO_NESTED
enum int CO_NESTED;
CO_NEWLOCALS
enum int CO_NEWLOCALS;
CO_NOFREE
enum int CO_NOFREE;

Masks for co_flags above

CO_OPTIMIZED
enum int CO_OPTIMIZED;
CO_VARARGS
enum int CO_VARARGS;
CO_VARKEYWORDS
enum int CO_VARKEYWORDS;

Masks for co_flags above

See Also

<a href="http://docs.python.org/c-api/code.html"> Code Objects </a>

Meta