Objetos Frame
*************

type PyFrameObject
    * Parte da API Limitada (como uma estrutura opaca).*

   A estrutura C dos objetos usados para descrever objetos frame.

   Não há membros públicos nesta estrutura.

   Alterado na versão 3.11: Os membros dessa estrutura foram removidos
   da API C pública. Consulte a entrada O Que há de Novo para
   detalhes.

As funções "PyEval_GetFrame()" e "PyThreadState_GetFrame()" podem ser
utilizadas para obter um objeto frame.

Veja também Reflexão.

PyTypeObject PyFrame_Type

   O tipo de objetos frame. É o mesmo objeto que "types.FrameType" na
   camada Python.

   Alterado na versão 3.11: Anteriormente, este tipo só estava
   disponível após incluir "<frameobject.h>".

int PyFrame_Check(PyObject *obj)

   Retorna diferente de zero se *obj* é um objeto frame

   Alterado na versão 3.11: Anteriormente, esta função só estava
   disponível após incluir "<frameobject.h>".

PyFrameObject *PyFrame_GetBack(PyFrameObject *frame)

   Obtém o *frame* próximo ao quadro externo.

   Retorna uma *referência forte* ou "NULL" se *frame* não tiver
   quadro externo.

   Adicionado na versão 3.9.

PyObject *PyFrame_GetBuiltins(PyFrameObject *frame)

   Get the *frame*'s "f_builtins" attribute.

   Retorna uma *referência forte*. O resultado não pode ser "NULL".

   Adicionado na versão 3.11.

PyCodeObject *PyFrame_GetCode(PyFrameObject *frame)
    * Parte da ABI Estável desde a versão 3.10.*

   Obtém o código de *frame*.

   Retorna uma *referência forte*.

   O resultado (código do frame) não pode ser "NULL".

   Adicionado na versão 3.9.

PyObject *PyFrame_GetGenerator(PyFrameObject *frame)

   Obtém o gerador, corrotina ou gerador assíncrono que possui este
   frame, ou "NULL" se o frame não pertence a um gerador. Não levanta
   exceção, mesmo que o valor retornado seja "NULL".

   Retorna uma *referência forte*, ou "NULL".

   Adicionado na versão 3.11.

PyObject *PyFrame_GetGlobals(PyFrameObject *frame)

   Get the *frame*'s "f_globals" attribute.

   Retorna uma *referência forte*. O resultado não pode ser "NULL".

   Adicionado na versão 3.11.

int PyFrame_GetLasti(PyFrameObject *frame)

   Get the *frame*'s "f_lasti" attribute.

   Retorna -1 se "frame.f_lasti" é "None".

   Adicionado na versão 3.11.

PyObject *PyFrame_GetVar(PyFrameObject *frame, PyObject *name)

   Get the variable *name* of *frame*.

   * Return a *strong reference* to the variable value on success.

   * Raise "NameError" and return "NULL" if the variable does not
     exist.

   * Raise an exception and return "NULL" on error.

   *name* type must be a "str".

   Adicionado na versão 3.12.

PyObject *PyFrame_GetVarString(PyFrameObject *frame, const char *name)

   Similar to "PyFrame_GetVar()", but the variable name is a C string
   encoded in UTF-8.

   Adicionado na versão 3.12.

PyObject *PyFrame_GetLocals(PyFrameObject *frame)

   Get the *frame*'s "f_locals" attribute ("dict").

   Retorna uma *referência forte*.

   Adicionado na versão 3.11.

int PyFrame_GetLineNumber(PyFrameObject *frame)
    * Parte da ABI Estável desde a versão 3.10.*

   Retorna o número da linha do *frame* atualmente em execução.


Internal Frames
===============

Unless using **PEP 523**, you will not need this.

struct _PyInterpreterFrame

   The interpreter's internal frame representation.

   Adicionado na versão 3.11.

PyObject *PyUnstable_InterpreterFrame_GetCode(struct _PyInterpreterFrame *frame);

   *Esta é uma API Instável. Isso pode se alterado sem aviso em
   lançamentos menores.*

      Return a *strong reference* to the code object for the frame.

   Adicionado na versão 3.12.

int PyUnstable_InterpreterFrame_GetLasti(struct _PyInterpreterFrame *frame);

   *Esta é uma API Instável. Isso pode se alterado sem aviso em
   lançamentos menores.*

   Return the byte offset into the last executed instruction.

   Adicionado na versão 3.12.

int PyUnstable_InterpreterFrame_GetLine(struct _PyInterpreterFrame *frame);

   *Esta é uma API Instável. Isso pode se alterado sem aviso em
   lançamentos menores.*

   Return the currently executing line number, or -1 if there is no
   line number.

   Adicionado na versão 3.12.
