[3.13] gh-120773: document introspective attributes of an async generator object in the inspect module (GH-120778) (#120827)

gh-120773: document introspective attributes of an async generator object in the inspect module (GH-120778)
(cherry picked from commit 83d3d7aace)

Co-authored-by: blhsing <blhsing@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-06-21 13:28:46 +02:00 committed by GitHub
parent f3d7823ede
commit abdbf337d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -42,220 +42,233 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
.. this function name is too big to fit in the ascii-art table below .. this function name is too big to fit in the ascii-art table below
.. |coroutine-origin-link| replace:: :func:`sys.set_coroutine_origin_tracking_depth` .. |coroutine-origin-link| replace:: :func:`sys.set_coroutine_origin_tracking_depth`
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| Type | Attribute | Description | | Type | Attribute | Description |
+===========+===================+===========================+ +=================+===================+===========================+
| class | __doc__ | documentation string | | class | __doc__ | documentation string |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __name__ | name with which this | | | __name__ | name with which this |
| | | class was defined | | | | class was defined |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __qualname__ | qualified name | | | __qualname__ | qualified name |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __module__ | name of module in which | | | __module__ | name of module in which |
| | | this class was defined | | | | this class was defined |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __type_params__ | A tuple containing the | | | __type_params__ | A tuple containing the |
| | | :ref:`type parameters | | | | :ref:`type parameters |
| | | <type-params>` of | | | | <type-params>` of |
| | | a generic class | | | | a generic class |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| method | __doc__ | documentation string | | method | __doc__ | documentation string |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __name__ | name with which this | | | __name__ | name with which this |
| | | method was defined | | | | method was defined |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __qualname__ | qualified name | | | __qualname__ | qualified name |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __func__ | function object | | | __func__ | function object |
| | | containing implementation | | | | containing implementation |
| | | of method | | | | of method |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __self__ | instance to which this | | | __self__ | instance to which this |
| | | method is bound, or | | | | method is bound, or |
| | | ``None`` | | | | ``None`` |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __module__ | name of module in which | | | __module__ | name of module in which |
| | | this method was defined | | | | this method was defined |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| function | __doc__ | documentation string | | function | __doc__ | documentation string |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __name__ | name with which this | | | __name__ | name with which this |
| | | function was defined | | | | function was defined |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __qualname__ | qualified name | | | __qualname__ | qualified name |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __code__ | code object containing | | | __code__ | code object containing |
| | | compiled function | | | | compiled function |
| | | :term:`bytecode` | | | | :term:`bytecode` |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __defaults__ | tuple of any default | | | __defaults__ | tuple of any default |
| | | values for positional or | | | | values for positional or |
| | | keyword parameters | | | | keyword parameters |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __kwdefaults__ | mapping of any default | | | __kwdefaults__ | mapping of any default |
| | | values for keyword-only | | | | values for keyword-only |
| | | parameters | | | | parameters |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __globals__ | global namespace in which | | | __globals__ | global namespace in which |
| | | this function was defined | | | | this function was defined |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __builtins__ | builtins namespace | | | __builtins__ | builtins namespace |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __annotations__ | mapping of parameters | | | __annotations__ | mapping of parameters |
| | | names to annotations; | | | | names to annotations; |
| | | ``"return"`` key is | | | | ``"return"`` key is |
| | | reserved for return | | | | reserved for return |
| | | annotations. | | | | annotations. |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __type_params__ | A tuple containing the | | | __type_params__ | A tuple containing the |
| | | :ref:`type parameters | | | | :ref:`type parameters |
| | | <type-params>` of | | | | <type-params>` of |
| | | a generic function | | | | a generic function |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __module__ | name of module in which | | | __module__ | name of module in which |
| | | this function was defined | | | | this function was defined |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| traceback | tb_frame | frame object at this | | traceback | tb_frame | frame object at this |
| | | level | | | | level |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | tb_lasti | index of last attempted | | | tb_lasti | index of last attempted |
| | | instruction in bytecode | | | | instruction in bytecode |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | tb_lineno | current line number in | | | tb_lineno | current line number in |
| | | Python source code | | | | Python source code |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | tb_next | next inner traceback | | | tb_next | next inner traceback |
| | | object (called by this | | | | object (called by this |
| | | level) | | | | level) |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| frame | f_back | next outer frame object | | frame | f_back | next outer frame object |
| | | (this frame's caller) | | | | (this frame's caller) |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | f_builtins | builtins namespace seen | | | f_builtins | builtins namespace seen |
| | | by this frame | | | | by this frame |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | f_code | code object being | | | f_code | code object being |
| | | executed in this frame | | | | executed in this frame |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | f_globals | global namespace seen by | | | f_globals | global namespace seen by |
| | | this frame | | | | this frame |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | f_lasti | index of last attempted | | | f_lasti | index of last attempted |
| | | instruction in bytecode | | | | instruction in bytecode |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | f_lineno | current line number in | | | f_lineno | current line number in |
| | | Python source code | | | | Python source code |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | f_locals | local namespace seen by | | | f_locals | local namespace seen by |
| | | this frame | | | | this frame |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | f_trace | tracing function for this | | | f_trace | tracing function for this |
| | | frame, or ``None`` | | | | frame, or ``None`` |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| code | co_argcount | number of arguments (not | | code | co_argcount | number of arguments (not |
| | | including keyword only | | | | including keyword only |
| | | arguments, \* or \*\* | | | | arguments, \* or \*\* |
| | | args) | | | | args) |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_code | string of raw compiled | | | co_code | string of raw compiled |
| | | bytecode | | | | bytecode |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_cellvars | tuple of names of cell | | | co_cellvars | tuple of names of cell |
| | | variables (referenced by | | | | variables (referenced by |
| | | containing scopes) | | | | containing scopes) |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_consts | tuple of constants used | | | co_consts | tuple of constants used |
| | | in the bytecode | | | | in the bytecode |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_filename | name of file in which | | | co_filename | name of file in which |
| | | this code object was | | | | this code object was |
| | | created | | | | created |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_firstlineno | number of first line in | | | co_firstlineno | number of first line in |
| | | Python source code | | | | Python source code |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_flags | bitmap of ``CO_*`` flags, | | | co_flags | bitmap of ``CO_*`` flags, |
| | | read more :ref:`here | | | | read more :ref:`here |
| | | <inspect-module-co-flags>`| | | | <inspect-module-co-flags>`|
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_lnotab | encoded mapping of line | | | co_lnotab | encoded mapping of line |
| | | numbers to bytecode | | | | numbers to bytecode |
| | | indices | | | | indices |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_freevars | tuple of names of free | | | co_freevars | tuple of names of free |
| | | variables (referenced via | | | | variables (referenced via |
| | | a function's closure) | | | | a function's closure) |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_posonlyargcount| number of positional only | | | co_posonlyargcount| number of positional only |
| | | arguments | | | | arguments |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_kwonlyargcount | number of keyword only | | | co_kwonlyargcount | number of keyword only |
| | | arguments (not including | | | | arguments (not including |
| | | \*\* arg) | | | | \*\* arg) |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_name | name with which this code | | | co_name | name with which this code |
| | | object was defined | | | | object was defined |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_qualname | fully qualified name with | | | co_qualname | fully qualified name with |
| | | which this code object | | | | which this code object |
| | | was defined | | | | was defined |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_names | tuple of names other | | | co_names | tuple of names other |
| | | than arguments and | | | | than arguments and |
| | | function locals | | | | function locals |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_nlocals | number of local variables | | | co_nlocals | number of local variables |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_stacksize | virtual machine stack | | | co_stacksize | virtual machine stack |
| | | space required | | | | space required |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | co_varnames | tuple of names of | | | co_varnames | tuple of names of |
| | | arguments and local | | | | arguments and local |
| | | variables | | | | variables |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| generator | __name__ | name | | generator | __name__ | name |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __qualname__ | qualified name | | | __qualname__ | qualified name |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | gi_frame | frame | | | gi_frame | frame |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | gi_running | is the generator running? | | | gi_running | is the generator running? |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | gi_code | code | | | gi_code | code |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | gi_yieldfrom | object being iterated by | | | gi_yieldfrom | object being iterated by |
| | | ``yield from``, or | | | | ``yield from``, or |
| | | ``None`` | | | | ``None`` |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| coroutine | __name__ | name | | async generator | __name__ | name |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __qualname__ | qualified name | | | __qualname__ | qualified name |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | cr_await | object being awaited on, | | | ag_await | object being awaited on, |
| | | or ``None`` | | | | or ``None`` |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | cr_frame | frame | | | ag_frame | frame |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | cr_running | is the coroutine running? | | | ag_running | is the generator running? |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | cr_code | code | | | ag_code | code |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | cr_origin | where coroutine was | | coroutine | __name__ | name |
| | | created, or ``None``. See | +-----------------+-------------------+---------------------------+
| | | |coroutine-origin-link| | | | __qualname__ | qualified name |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| builtin | __doc__ | documentation string | | | cr_await | object being awaited on, |
+-----------+-------------------+---------------------------+ | | | or ``None`` |
| | __name__ | original name of this | +-----------------+-------------------+---------------------------+
| | | function or method | | | cr_frame | frame |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __qualname__ | qualified name | | | cr_running | is the coroutine running? |
+-----------+-------------------+---------------------------+ +-----------------+-------------------+---------------------------+
| | __self__ | instance to which a | | | cr_code | code |
| | | method is bound, or | +-----------------+-------------------+---------------------------+
| | | ``None`` | | | cr_origin | where coroutine was |
+-----------+-------------------+---------------------------+ | | | created, or ``None``. See |
| | | |coroutine-origin-link| |
+-----------------+-------------------+---------------------------+
| builtin | __doc__ | documentation string |
+-----------------+-------------------+---------------------------+
| | __name__ | original name of this |
| | | function or method |
+-----------------+-------------------+---------------------------+
| | __qualname__ | qualified name |
+-----------------+-------------------+---------------------------+
| | __self__ | instance to which a |
| | | method is bound, or |
| | | ``None`` |
+-----------------+-------------------+---------------------------+
.. versionchanged:: 3.5 .. versionchanged:: 3.5