cpython/Doc/c-api/reflection.rst

56 lines
1.5 KiB
ReStructuredText
Raw Normal View History

2008-01-19 18:14:27 -04:00
.. highlightlang:: c
.. _reflection:
Reflection
==========
2012-01-14 11:42:02 -04:00
.. c:function:: PyObject* PyEval_GetBuiltins()
2008-01-19 18:14:27 -04:00
Return a dictionary of the builtins in the current execution frame,
or the interpreter of the thread state if no frame is currently executing.
2012-01-14 11:42:02 -04:00
.. c:function:: PyObject* PyEval_GetLocals()
2008-01-19 18:14:27 -04:00
Return a dictionary of the local variables in the current execution frame,
or *NULL* if no frame is currently executing.
2009-01-03 16:55:06 -04:00
2008-01-19 18:14:27 -04:00
2012-01-14 11:42:02 -04:00
.. c:function:: PyObject* PyEval_GetGlobals()
2008-01-19 18:14:27 -04:00
Return a dictionary of the global variables in the current execution frame,
or *NULL* if no frame is currently executing.
2012-01-14 11:42:02 -04:00
.. c:function:: PyFrameObject* PyEval_GetFrame()
2008-01-19 18:14:27 -04:00
Return the current thread state's frame, which is *NULL* if no frame is
currently executing.
2012-01-14 11:42:02 -04:00
.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
Return the line number that *frame* is currently executing.
2012-01-14 11:42:02 -04:00
.. c:function:: int PyEval_GetRestricted()
2008-01-19 18:14:27 -04:00
If there is a current frame and it is executing in restricted mode, return true,
otherwise false.
2012-01-14 11:42:02 -04:00
.. c:function:: const char* PyEval_GetFuncName(PyObject *func)
2008-01-19 18:14:27 -04:00
Return the name of *func* if it is a function, class or instance object, else the
name of *func*\s type.
2012-01-14 11:42:02 -04:00
.. c:function:: const char* PyEval_GetFuncDesc(PyObject *func)
2008-01-19 18:14:27 -04:00
Return a description string, depending on the type of *func*.
Return values include "()" for functions and methods, " constructor",
" instance", and " object". Concatenated with the result of
2012-01-14 11:42:02 -04:00
:c:func:`PyEval_GetFuncName`, the result will be a description of
2008-01-19 18:14:27 -04:00
*func*.