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)
    *Retorna valor: Nova referência.*

   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)
    *Retorna valor: Nova referência.*

   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)
    *Retorna valor: Nova referência.** 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)
    *Retorna valor: Nova referência.*

   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)
    *Retorna valor: Nova referência.*

   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)
    *Retorna valor: Nova referência.*

   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)
    *Retorna valor: Nova referência.*

   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)
    *Retorna valor: Nova referência.*

   Get the *frame*'s "f_locals" attribute. If the frame refers to an
   *optimized scope*, this returns a write-through proxy object that
   allows modifying the locals. In all other cases (classes, modules,
   "exec()", "eval()") it returns the mapping representing the frame
   locals directly (as described for "locals()").

   Retorna uma *referência forte*.

   Adicionado na versão 3.11.

   Alterado na versão 3.13: As part of **PEP 667**, return an instance
   of "PyFrameLocalsProxy_Type".

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.


Frame Locals Proxies
====================

Adicionado na versão 3.13.

The "f_locals" attribute on a frame object is an instance of a "frame-
locals proxy". The proxy object exposes a write-through view of the
underlying locals dictionary for the frame. This ensures that the
variables exposed by "f_locals" are always up to date with the live
local variables in the frame itself.

See **PEP 667** for more information.

PyTypeObject PyFrameLocalsProxy_Type

   The type of frame "locals()" proxy objects.

int PyFrameLocalsProxy_Check(PyObject *obj)

   Return non-zero if *obj* is a frame "locals()" proxy.


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.
