@@ -28,25 +28,29 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2828
2929******************************************************************/
3030
31- /* Definitions for compiled intermediate code */
32-
33-
34- /* An intermediate code fragment contains:
35- - a string that encodes the instructions,
36- - a list of the constants,
37- - a list of the names used,
38- - the filename from which it was compiled,
39- - the name of the object for which it was compiled. */
31+ /* Definitions for bytecode */
4032
33+ /* Bytecode object */
4134typedef struct {
4235 PyObject_HEAD
43- PyStringObject * co_code ; /* instruction opcodes */
44- PyObject * co_consts ; /* list of immutable constant objects */
45- PyObject * co_names ; /* list of stringobjects */
46- PyObject * co_filename ; /* string */
47- PyObject * co_name ; /* string */
36+ int co_argcount ; /* #arguments, except *args */
37+ int co_nlocals ; /* #local variables */
38+ int co_flags ; /* CO_..., see below */
39+ PyStringObject * co_code ; /* instruction opcodes */
40+ PyObject * co_consts ; /* list (constants used) */
41+ PyObject * co_names ; /* list of strings (names used) */
42+ PyObject * co_varnames ; /* tuple of strings (local variable names) */
43+ /* The rest doesn't count for hash/cmp */
44+ PyObject * co_filename ; /* string (where it was loaded from) */
45+ PyObject * co_name ; /* string (name, for reference) */
4846} PyCodeObject ;
4947
48+ /* Masks for co_flags above */
49+ #define CO_OPTIMIZED 0x0001
50+ #define CO_NEWLOCALS 0x0002
51+ #define CO_VARARGS 0x0004
52+ #define CO_VARKEYWORDS 0x0008
53+
5054extern DL_IMPORT (PyTypeObject ) PyCode_Type ;
5155
5256#define PyCode_Check (op ) ((op)->ob_type == &PyCode_Type)
@@ -55,8 +59,9 @@ extern DL_IMPORT(PyTypeObject) PyCode_Type;
5559/* Public interface */
5660struct _node ; /* Declare the existence of this type */
5761PyCodeObject * PyNode_Compile Py_PROTO ((struct _node * , char * ) );
58- PyCodeObject * PyCode_New
59- Py_PROTO ((PyObject * , PyObject * , PyObject * , PyObject * , PyObject * ) );
62+ PyCodeObject * PyCode_New Py_PROTO ((
63+ int , int , int , PyObject * , PyObject * , PyObject * , PyObject * ,
64+ PyObject * , PyObject * )); /* same as struct above */
6065
6166#ifdef __cplusplus
6267}
0 commit comments