PEP 227 implementation
Track changes to PyFrame_New() and PyFuntion_New().
This commit is contained in:
parent
f65e500594
commit
903f654ac9
|
@ -101,7 +101,7 @@ new_function(PyObject* unused, PyObject* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
static char new_code_doc[] =
|
static char new_code_doc[] =
|
||||||
"Create a code object from (ARGCOUNT, NLOCALS, STACKSIZE, FLAGS, CODESTRING, CONSTANTS, NAMES, VARNAMES, FILENAME, NAME, FIRSTLINENO, LNOTAB).";
|
"Create a code object from (ARGCOUNT, NLOCALS, STACKSIZE, FLAGS, CODESTRING, CONSTANTS, NAMES, VARNAMES, FREEVARS, CELLVARS, FILENAME, NAME, FIRSTLINENO, LNOTAB).";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
new_code(PyObject* unused, PyObject* args)
|
new_code(PyObject* unused, PyObject* args)
|
||||||
|
@ -114,18 +114,22 @@ new_code(PyObject* unused, PyObject* args)
|
||||||
PyObject* consts;
|
PyObject* consts;
|
||||||
PyObject* names;
|
PyObject* names;
|
||||||
PyObject* varnames;
|
PyObject* varnames;
|
||||||
|
PyObject* freevars;
|
||||||
|
PyObject* cellvars;
|
||||||
PyObject* filename;
|
PyObject* filename;
|
||||||
PyObject* name;
|
PyObject* name;
|
||||||
int firstlineno;
|
int firstlineno;
|
||||||
PyObject* lnotab;
|
PyObject* lnotab;
|
||||||
PyBufferProcs *pb;
|
PyBufferProcs *pb;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "iiiiOO!O!O!SSiS:code",
|
if (!PyArg_ParseTuple(args, "iiiiOO!O!O!O!O!SSiS:code",
|
||||||
&argcount, &nlocals, &stacksize, &flags,
|
&argcount, &nlocals, &stacksize, &flags,
|
||||||
&code,
|
&code,
|
||||||
&PyTuple_Type, &consts,
|
&PyTuple_Type, &consts,
|
||||||
&PyTuple_Type, &names,
|
&PyTuple_Type, &names,
|
||||||
&PyTuple_Type, &varnames,
|
&PyTuple_Type, &varnames,
|
||||||
|
&PyTuple_Type, &freevars,
|
||||||
|
&PyTuple_Type, &cellvars,
|
||||||
&filename, &name,
|
&filename, &name,
|
||||||
&firstlineno, &lnotab))
|
&firstlineno, &lnotab))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -143,7 +147,8 @@ new_code(PyObject* unused, PyObject* args)
|
||||||
|
|
||||||
return (PyObject *)PyCode_New(argcount, nlocals, stacksize, flags,
|
return (PyObject *)PyCode_New(argcount, nlocals, stacksize, flags,
|
||||||
code, consts, names, varnames,
|
code, consts, names, varnames,
|
||||||
filename, name, firstlineno, lnotab);
|
freevars, cellvars, filename, name,
|
||||||
|
firstlineno, lnotab);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char new_module_doc[] =
|
static char new_module_doc[] =
|
||||||
|
|
|
@ -257,6 +257,8 @@ getcode(enum HandlerTypes slot, char* func_name, int lineno)
|
||||||
nulltuple, /* consts */
|
nulltuple, /* consts */
|
||||||
nulltuple, /* names */
|
nulltuple, /* names */
|
||||||
nulltuple, /* varnames */
|
nulltuple, /* varnames */
|
||||||
|
nulltuple, /* freevars */
|
||||||
|
nulltuple, /* cellvars */
|
||||||
filename, /* filename */
|
filename, /* filename */
|
||||||
name, /* name */
|
name, /* name */
|
||||||
lineno, /* firstlineno */
|
lineno, /* firstlineno */
|
||||||
|
@ -288,7 +290,9 @@ call_with_frame(PyCodeObject *c, PyObject* func, PyObject* args)
|
||||||
tstate, /*back*/
|
tstate, /*back*/
|
||||||
c, /*code*/
|
c, /*code*/
|
||||||
tstate->frame->f_globals, /*globals*/
|
tstate->frame->f_globals, /*globals*/
|
||||||
NULL); /*locals*/
|
NULL, /*locals*/
|
||||||
|
0,
|
||||||
|
NULL); /* closure */
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
tstate->frame = f;
|
tstate->frame = f;
|
||||||
|
|
Loading…
Reference in New Issue