1.. highlight:: c
2
3.. _reflection:
4
5Reflection
6==========
7
8.. c:function:: PyObject* PyEval_GetBuiltins(void)
9
10   Return a dictionary of the builtins in the current execution frame,
11   or the interpreter of the thread state if no frame is currently executing.
12
13
14.. c:function:: PyObject* PyEval_GetLocals(void)
15
16   Return a dictionary of the local variables in the current execution frame,
17   or ``NULL`` if no frame is currently executing.
18
19
20.. c:function:: PyObject* PyEval_GetGlobals(void)
21
22   Return a dictionary of the global variables in the current execution frame,
23   or ``NULL`` if no frame is currently executing.
24
25
26.. c:function:: PyFrameObject* PyEval_GetFrame(void)
27
28   Return the current thread state's frame, which is ``NULL`` if no frame is
29   currently executing.
30
31   See also :c:func:`PyThreadState_GetFrame`.
32
33
34.. c:function:: int PyFrame_GetBack(PyFrameObject *frame)
35
36   Get the *frame* next outer frame.
37
38   Return a strong reference, or ``NULL`` if *frame* has no outer frame.
39
40   *frame* must not be ``NULL``.
41
42   .. versionadded:: 3.9
43
44
45.. c:function:: int PyFrame_GetCode(PyFrameObject *frame)
46
47   Get the *frame* code.
48
49   Return a strong reference.
50
51   *frame* must not be ``NULL``. The result (frame code) cannot be ``NULL``.
52
53   .. versionadded:: 3.9
54
55
56.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
57
58   Return the line number that *frame* is currently executing.
59
60   *frame* must not be ``NULL``.
61
62
63.. c:function:: const char* PyEval_GetFuncName(PyObject *func)
64
65   Return the name of *func* if it is a function, class or instance object, else the
66   name of *func*\s type.
67
68
69.. c:function:: const char* PyEval_GetFuncDesc(PyObject *func)
70
71   Return a description string, depending on the type of *func*.
72   Return values include "()" for functions and methods, " constructor",
73   " instance", and " object".  Concatenated with the result of
74   :c:func:`PyEval_GetFuncName`, the result will be a description of
75   *func*.
76