/Doc/c-api/reflection.rst

http://unladen-swallow.googlecode.com/ · ReStructuredText · 50 lines · 28 code · 22 blank · 0 comment · 0 complexity · bc4a3dcacc122637d23a58c965c554e8 MD5 · raw file

  1. .. highlightlang:: c
  2. .. _reflection:
  3. Reflection
  4. ==========
  5. .. cfunction:: PyObject* PyEval_GetBuiltins()
  6. Return a dictionary of the builtins in the current execution frame,
  7. or the interpreter of the thread state if no frame is currently executing.
  8. .. cfunction:: PyObject* PyEval_GetLocals()
  9. Return a dictionary of the local variables in the current execution frame,
  10. or *NULL* if no frame is currently executing.
  11. .. cfunction:: PyObject* PyEval_GetGlobals()
  12. Return a dictionary of the global variables in the current execution frame,
  13. or *NULL* if no frame is currently executing.
  14. .. cfunction:: PyFrameObject* PyEval_GetFrame()
  15. Return the current thread state's frame, which is *NULL* if no frame is
  16. currently executing.
  17. .. cfunction:: int PyEval_GetRestricted()
  18. If there is a current frame and it is executing in restricted mode, return true,
  19. otherwise false.
  20. .. cfunction:: const char* PyEval_GetFuncName(PyObject *func)
  21. Return the name of *func* if it is a function, class or instance object, else the
  22. name of *func*\s type.
  23. .. cfunction:: const char* PyEval_GetFuncDesc(PyObject *func)
  24. Return a description string, depending on the type of *func*.
  25. Return values include "()" for functions and methods, " constructor",
  26. " instance", and " object". Concatenated with the result of
  27. :cfunc:`PyEval_GetFuncName`, the result will be a description of
  28. *func*.