diff -r 23f0529a8b2f Doc/c-api/concrete.rst --- a/Doc/c-api/concrete.rst Thu Nov 07 22:22:39 2013 +0100 +++ b/Doc/c-api/concrete.rst Thu Nov 07 22:34:17 2013 +0100 @@ -103,6 +103,7 @@ Other Objects .. toctree:: + frame.rst file.rst module.rst iterator.rst diff -r 23f0529a8b2f Doc/c-api/frame.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Doc/c-api/frame.rst Thu Nov 07 22:34:17 2013 +0100 @@ -0,0 +1,56 @@ +.. highlightlang:: c + +Frame Objects +------------- + +.. c:type:: PyFrameObject + + Frame objects represent execution frames: see :ref:`Frame objects + `. + + +.. c:function:: PyFrameObject* PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, PyObject *locals) + + Create a new frame attached linked to the current frame of the thread + *tstate*. Parameters: + + - *code* is a :c:type:`PyCodeObject` + - *globals* is an optional :c:type:`PyDictObject` dictionary, + it can be ``NULL`` + - *locals* is a optional :c:type:`PyDictObject` dictionary, + it can be ``NULL`` + + *globals* dictionary should contain the key ``'__builtins__'``. Otherwise, + an empty dictionary is created for builtin functions. + + If the code object has the ``CO_NEWLOCALS`` flag set, the frame uses an new + empty dictionary for locals. Otherwise, the *locals* is used if set, or + *globals* if *locals* is ``NULL``. + + +.. c:function:: int PyFrame_FastToLocalsWithError(PyFrameObject *f) + + Convert frame fast variables to frame local variables. + Return ``0`` on success, raise an exception and return ``-1`` on error. + + .. versionadded:: 3.4 + + +.. c:function:: void PyFrame_FastToLocals(PyFrameObject *f) + + Similar to :c:func:`PyFrame_FastToLocalsWithError`, but ignore errors. + Exceptions are ignored: on error, the local variables are in an undefined + state. + + +.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *f) + + Get the current line number of the frame. + + +.. c:function:: void PyFrame_LocalsToFast(PyFrameObject *f, int clear) + + Convert frame local variables to frame fast variables. + Exceptions are ignored: on error, the fast variables are in an undefined + state. +