Objets décrivant les *frames*
*****************************

type PyFrameObject
    * Part of the Limited API (as an opaque struct).*

   Structure des objets C utilisée pour décrire les objets *frame*.

   Il n'y a pas de membres publics dans cette structure.

   Modifié dans la version 3.11: Les membres de la structure API
   publique ont été retirés de l'API publique de C. Visiter l'entrée
   dans la page des nouveautés de Python pour plus détails.

Les fonctions "PyEval_GetFrame()" et "PyThreadState_GetFrame()"
peuvent être utilisées pour avoir un objet de *frame*.

Voir aussi Réflexion

PyTypeObject PyFrame_Type

   Le type des objets de *frame*. C'est le même objet que
   "types.FrameType" dans la couche de Python.

   Modifié dans la version 3.11: Précédemment, ce type était
   disponible uniquement après l'inclusion de "<frameobject.h>".

int PyFrame_Check(PyObject *obj)

   Renvoie un entier non nul si *obj* est un objet *frame*.

   Modifié dans la version 3.11: Précédemment, ce type était
   disponible uniquement après l'inclusion de "<frameobject.h>".

PyFrameObject *PyFrame_GetBack(PyFrameObject *frame)
    *Valeur de retour : nouvelle référence.*

   Renvoie la *frame* encadrant immédiatement à *frame*.

   Renvoie un *strong reference*, ou "NULL" si *frame* n'a pas de
   *frame* encadrante.

   Ajouté dans la version 3.9.

PyObject *PyFrame_GetBuiltins(PyFrameObject *frame)
    *Valeur de retour : nouvelle référence.*

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

   Renvoie un *strong reference*. Le résultat ne peut être "NULL".

   Ajouté dans la version 3.11.

PyCodeObject *PyFrame_GetCode(PyFrameObject *frame)
    *Valeur de retour : nouvelle référence.** Part of the Stable ABI
   since version 3.10.*

   Obtenir le code *frame*.

   Renvoie un *strong reference*.

   Le résultat (code *frame*) ne peut être "NULL".

   Ajouté dans la version 3.9.

PyObject *PyFrame_GetGenerator(PyFrameObject *frame)
    *Valeur de retour : nouvelle référence.*

   Obtenir le générateur, coroutine, ou un générateur asynchrone qui
   maintient cette *frame*, ou "NULL" si cette *frame* n'est pas
   maintenu par un générateur. Il ne lève pas d'exception, même si la
   valeur renvoyée est "NULL".

   Renvoie un *strong reference*, ou "NULL".

   Ajouté dans la version 3.11.

PyObject *PyFrame_GetGlobals(PyFrameObject *frame)
    *Valeur de retour : nouvelle référence.*

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

   Renvoie un *strong reference*. Le résultat ne peut être "NULL".

   Ajouté dans la version 3.11.

int PyFrame_GetLasti(PyFrameObject *frame)

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

   Renvoie -1 si "frame.f_lasti" est "None".

   Ajouté dans la version 3.11.

PyObject *PyFrame_GetVar(PyFrameObject *frame, PyObject *name)
    *Valeur de retour : nouvelle référence.*

   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".

   Ajouté dans la version 3.12.

PyObject *PyFrame_GetVarString(PyFrameObject *frame, const char *name)
    *Valeur de retour : nouvelle référence.*

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

   Ajouté dans la version 3.12.

PyObject *PyFrame_GetLocals(PyFrameObject *frame)
    *Valeur de retour : nouvelle référence.*

   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()").

   Renvoie un *strong reference*.

   Ajouté dans la version 3.11.

   Modifié dans la version 3.13: As part of **PEP 667**, return a
   proxy object for optimized scopes.

int PyFrame_GetLineNumber(PyFrameObject *frame)
    * Part of the Stable ABI since version 3.10.*

   Renvoie le numéro de ligne que cette *frame* est en train
   d'exécuter.


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

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

struct _PyInterpreterFrame

   The interpreter's internal frame representation.

   Ajouté dans la version 3.11.

PyObject *PyUnstable_InterpreterFrame_GetCode(struct _PyInterpreterFrame *frame);

   *This is Unstable API. It may change without warning in minor
   releases.*

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

   Ajouté dans la version 3.12.

int PyUnstable_InterpreterFrame_GetLasti(struct _PyInterpreterFrame *frame);

   *This is Unstable API. It may change without warning in minor
   releases.*

   Return the byte offset into the last executed instruction.

   Ajouté dans la version 3.12.

int PyUnstable_InterpreterFrame_GetLine(struct _PyInterpreterFrame *frame);

   *This is Unstable API. It may change without warning in minor
   releases.*

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

   Ajouté dans la version 3.12.
