Text of docs.python.org › uk › 3 › c-api › reflection.html as Styx crawled it on Nov 20, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

Рефлексія — Python 3.15.2 documentation

Навігація індекс модулі | наступний | попередній | Python » 3.15.2 documentation » Python/C API reference manual » Комунальні послуги » Рефлексія | Theme | Рефлексія ¶ PyObject * PyEval_GetBuiltins ( void ) ¶ Return value: Borrowed reference. Part of the Stable ABI . Застаріло починаючи з версії 3.13: Use PyEval_GetFrameBuiltins() instead.

Повертає словник вбудованих модулів у поточному кадрі виконання або інтерпретатор стану потоку, якщо наразі жоден кадр не виконується. PyObject * PyEval_GetLocals ( void ) ¶ Return value: Borrowed reference. Part of the Stable ABI . Застаріло починаючи з версії 3.13: Use either PyEval_GetFrameLocals() to obtain the same behaviour as calling locals() in Python code, or else call PyFrame_GetLocals() on the result of PyEval_GetFrame() to access the f_locals attribute of the currently executing frame.

Return a mapping providing access to the local variables in the current execution frame, or NULL if no frame is currently executing. Refer to locals() for details of the mapping returned at different scopes. As this function returns a borrowed reference , the dictionary returned for optimized scopes is cached on the frame object and will remain alive as long as the frame object does. Unlike PyEval_GetFrameLocals() and locals() , subsequent calls to this function in the same frame will update the contents of the cached dictionary to reflect changes in the state of the local variables rather than returning a new snapshot.

Змінено в версії 3.13: As part of PEP 667 , PyFrame_GetLocals() , locals() , and FrameType.f_locals no longer make use of the shared cache dictionary. Refer to the What’s New entry for additional details. PyObject * PyEval_GetGlobals ( void ) ¶ Return value: Borrowed reference. Part of the Stable ABI . Застаріло починаючи з версії 3.13: Use PyEval_GetFrameGlobals() instead. Повертає словник глобальних змінних у поточному кадрі виконання або NULL , якщо наразі жоден кадр не виконується.

PyFrameObject * PyEval_GetFrame ( void ) ¶ Return value: Borrowed reference. Part of the Stable ABI . Return the attached thread state ’s frame, which is NULL if no frame is currently executing. Дивіться також PyThreadState_GetFrame() . PyObject * PyEval_GetFrameBuiltins ( void ) ¶ Return value: New reference. Part of the Stable ABI since version 3.13. Повертає словник вбудованих модулів у поточному кадрі виконання або інтерпретатор стану потоку, якщо наразі жоден кадр не виконується.

Added in version 3.13. PyObject * PyEval_GetFrameLocals ( void ) ¶ Return value: New reference. Part of the Stable ABI since version 3.13. Return a dictionary of the local variables in the current execution frame, or NULL if no frame is currently executing. Equivalent to calling locals() in Python code. To access f_locals on the current frame without making an independent snapshot in optimized scopes , call PyFrame_GetLocals() on the result of PyEval_GetFrame() .

Added in version 3.13. PyObject * PyEval_GetFrameGlobals ( void ) ¶ Return value: New reference. Part of the Stable ABI since version 3.13. Return a dictionary of the global variables in the current execution frame, or NULL if no frame is currently executing. Equivalent to calling globals() in Python code. Added in version 3.13. const char * PyEval_GetFuncName ( PyObject * func ) ¶ Part of the Stable ABI . Повертає ім’я func , якщо це функція, клас або об’єкт примірника, інакше ім’я типу func s.

For a Python function or method, the returned pointer refers to the function’s name and must not be retained across operations that may change that name. In the free-threaded build, copy the string before detaching the thread state or executing Python code if the name may be modified concurrently. const char * PyEval_GetFuncDesc ( PyObject * func ) ¶ Part of the Stable ABI . Повертає рядок опису залежно від типу func .

Повернуті значення включають «()» для функцій і методів, «конструктор», «примірник» і «об’єкт». Поєднаний із результатом PyEval_GetFuncName() , результат буде описом func . Попередній розділ PyHash API Наступна тема Реєстр кодеків і функції підтримки This page Report a bug Improve this page Show source Show translation source « Навігація індекс модулі | наступний | попередній | Python » 3.15.2 documentation » Python/C API reference manual » Комунальні послуги » Рефлексія | Theme | © Авторське право 2001 Python Software Foundation.

This page is licensed under the Python Software Foundation License Version 2. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License. See History and License for more information. The Python Software Foundation is a non-profit corporation. Please donate. Востаннє оновлено лист. 19, 2026 (11:14 UTC). Found a bug ? Created using Sphinx 9.1.1.