Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 1 | .. highlightlang:: c |
| 2 | |
| 3 | .. _reflection: |
| 4 | |
| 5 | Reflection |
| 6 | ========== |
| 7 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame^] | 8 | .. c:function:: PyObject* PyEval_GetBuiltins() |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 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 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame^] | 14 | .. c:function:: PyObject* PyEval_GetLocals() |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 15 | |
| 16 | Return a dictionary of the local variables in the current execution frame, |
| 17 | or *NULL* if no frame is currently executing. |
Georg Brandl | 48310cd | 2009-01-03 21:18:54 +0000 | [diff] [blame] | 18 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 19 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame^] | 20 | .. c:function:: PyObject* PyEval_GetGlobals() |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 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 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame^] | 26 | .. c:function:: PyFrameObject* PyEval_GetFrame() |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 27 | |
| 28 | Return the current thread state's frame, which is *NULL* if no frame is |
| 29 | currently executing. |
| 30 | |
| 31 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame^] | 32 | .. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame) |
Alexandre Vassalotti | 7b82b40 | 2009-07-21 04:30:03 +0000 | [diff] [blame] | 33 | |
| 34 | Return the line number that *frame* is currently executing. |
| 35 | |
| 36 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame^] | 37 | .. c:function:: const char* PyEval_GetFuncName(PyObject *func) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 38 | |
| 39 | Return the name of *func* if it is a function, class or instance object, else the |
| 40 | name of *func*\s type. |
| 41 | |
| 42 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame^] | 43 | .. c:function:: const char* PyEval_GetFuncDesc(PyObject *func) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 44 | |
| 45 | Return a description string, depending on the type of *func*. |
| 46 | Return values include "()" for functions and methods, " constructor", |
| 47 | " instance", and " object". Concatenated with the result of |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame^] | 48 | :c:func:`PyEval_GetFuncName`, the result will be a description of |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 49 | *func*. |