mirror of https://github.com/python/cpython.git
Get rid of f_restricted too. Doc the other 4 ints that were already removed
at the NeedForSpeed sprint.
This commit is contained in:
parent
2585ad58e6
commit
b9845e72f9
|
@ -41,8 +41,6 @@ typedef struct _frame {
|
||||||
/* As of 2.3 f_lineno is only valid when tracing is active (i.e. when
|
/* As of 2.3 f_lineno is only valid when tracing is active (i.e. when
|
||||||
f_trace is set) -- at other times use PyCode_Addr2Line instead. */
|
f_trace is set) -- at other times use PyCode_Addr2Line instead. */
|
||||||
int f_lineno; /* Current line number */
|
int f_lineno; /* Current line number */
|
||||||
int f_restricted; /* Flag set if restricted operations
|
|
||||||
in this scope */
|
|
||||||
int f_iblock; /* index in f_blockstack */
|
int f_iblock; /* index in f_blockstack */
|
||||||
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
|
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
|
||||||
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
|
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
|
||||||
|
@ -54,6 +52,8 @@ typedef struct _frame {
|
||||||
PyAPI_DATA(PyTypeObject) PyFrame_Type;
|
PyAPI_DATA(PyTypeObject) PyFrame_Type;
|
||||||
|
|
||||||
#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)
|
#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)
|
||||||
|
#define PyFrame_IsRestricted(f) \
|
||||||
|
((f)->f_builtins != (f)->f_tstate->interp->builtins)
|
||||||
|
|
||||||
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
|
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
|
||||||
PyObject *, PyObject *);
|
PyObject *, PyObject *);
|
||||||
|
|
|
@ -12,6 +12,9 @@ What's New in Python 2.5 beta 1?
|
||||||
Core and builtins
|
Core and builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Removed 5 integers from C frame objects (PyFrameObject).
|
||||||
|
f_nlocals, f_ncells, f_nfreevars, f_stack_size, f_restricted.
|
||||||
|
|
||||||
- Bug #532646: object.__call__() will continue looking for the __call__
|
- Bug #532646: object.__call__() will continue looking for the __call__
|
||||||
attribute on objects until one without one is found. This leads to recursion
|
attribute on objects until one without one is found. This leads to recursion
|
||||||
when you take a class and set its __call__ attribute to an instance of the
|
when you take a class and set its __call__ attribute to an instance of the
|
||||||
|
|
|
@ -20,7 +20,6 @@ static PyMemberDef frame_memberlist[] = {
|
||||||
{"f_builtins", T_OBJECT, OFF(f_builtins),RO},
|
{"f_builtins", T_OBJECT, OFF(f_builtins),RO},
|
||||||
{"f_globals", T_OBJECT, OFF(f_globals), RO},
|
{"f_globals", T_OBJECT, OFF(f_globals), RO},
|
||||||
{"f_lasti", T_INT, OFF(f_lasti), RO},
|
{"f_lasti", T_INT, OFF(f_lasti), RO},
|
||||||
{"f_restricted",T_INT, OFF(f_restricted),RO},
|
|
||||||
{"f_exc_type", T_OBJECT, OFF(f_exc_type)},
|
{"f_exc_type", T_OBJECT, OFF(f_exc_type)},
|
||||||
{"f_exc_value", T_OBJECT, OFF(f_exc_value)},
|
{"f_exc_value", T_OBJECT, OFF(f_exc_value)},
|
||||||
{"f_exc_traceback", T_OBJECT, OFF(f_exc_traceback)},
|
{"f_exc_traceback", T_OBJECT, OFF(f_exc_traceback)},
|
||||||
|
@ -341,11 +340,18 @@ frame_settrace(PyFrameObject *f, PyObject* v, void *closure)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
frame_getrestricted(PyFrameObject *f, void *closure)
|
||||||
|
{
|
||||||
|
return PyBool_FromLong(PyFrame_IsRestricted(f));
|
||||||
|
}
|
||||||
|
|
||||||
static PyGetSetDef frame_getsetlist[] = {
|
static PyGetSetDef frame_getsetlist[] = {
|
||||||
{"f_locals", (getter)frame_getlocals, NULL, NULL},
|
{"f_locals", (getter)frame_getlocals, NULL, NULL},
|
||||||
{"f_lineno", (getter)frame_getlineno,
|
{"f_lineno", (getter)frame_getlineno,
|
||||||
(setter)frame_setlineno, NULL},
|
(setter)frame_setlineno, NULL},
|
||||||
{"f_trace", (getter)frame_gettrace, (setter)frame_settrace, NULL},
|
{"f_trace", (getter)frame_gettrace, (setter)frame_settrace, NULL},
|
||||||
|
{"f_restricted",(getter)frame_getrestricted,NULL, NULL},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -664,7 +670,6 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
|
||||||
|
|
||||||
f->f_lasti = -1;
|
f->f_lasti = -1;
|
||||||
f->f_lineno = code->co_firstlineno;
|
f->f_lineno = code->co_firstlineno;
|
||||||
f->f_restricted = (builtins != tstate->interp->builtins);
|
|
||||||
f->f_iblock = 0;
|
f->f_iblock = 0;
|
||||||
|
|
||||||
f->f_stacktop = f->f_valuestack;
|
f->f_stacktop = f->f_valuestack;
|
||||||
|
|
|
@ -3354,7 +3354,7 @@ int
|
||||||
PyEval_GetRestricted(void)
|
PyEval_GetRestricted(void)
|
||||||
{
|
{
|
||||||
PyFrameObject *current_frame = PyEval_GetFrame();
|
PyFrameObject *current_frame = PyEval_GetFrame();
|
||||||
return current_frame == NULL ? 0 : current_frame->f_restricted;
|
return current_frame == NULL ? 0 : PyFrame_IsRestricted(current_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue