Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-97696 Add documentation for get_coro() behavior with eager tasks #104189

Closed
wants to merge 62 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
5c30058
gh-97696 Add documentation for get_coro() behavior with eager tasks
jbower-fb May 5, 2023
248b78b
Update asyncio-task.rst
jbower-fb May 5, 2023
3205457
gh-104190: fix ubsan crash (#104191)
sunmy2019 May 5, 2023
4126669
gh-104051: fix crash in test_xxtestfuzz with -We (#104052)
iritkatriel May 5, 2023
992dead
GH-103092: port `_asyncio` freelist to module state (#104196)
kumaraditya303 May 5, 2023
be60d71
gh-64658: Expand Argument Clinic return converter docs (#104175)
erlend-aasland May 5, 2023
582fe9a
gh-68395: Avoid naming conflicts by mangling variable names in Argume…
erlend-aasland May 5, 2023
78dc058
gh-64631: Test exception messages in cloned Argument Clinic funcs (#1…
erlend-aasland May 5, 2023
d3192a2
gh-64595: Argument Clinic: Touch source file if any output file chang…
erlend-aasland May 5, 2023
5405b60
GH-96803: Add three C-API functions to make _PyInterpreterFrame less …
markshannon May 5, 2023
21fb990
gh-103533: Use PEP 669 APIs for cprofile (GH-103534)
gaogaotiantian May 5, 2023
ef989ab
gh-69152: Add _proxy_response_headers attribute to HTTPConnection (#2…
nametkin May 5, 2023
0b62e96
GH-100479: Add `pathlib.PurePath.with_segments()` (GH-103975)
barneygale May 5, 2023
0826f80
gh-99113: Share the GIL via PyInterpreterState.ceval.gil (gh-104203)
ericsnowcurrently May 5, 2023
efc84cd
gh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (gh-1…
ericsnowcurrently May 5, 2023
7192a46
gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)
ericsnowcurrently May 5, 2023
c205faa
gh-104146: Remove unused var 'parser_body_declarations' from clinic.p…
erlend-aasland May 5, 2023
b057233
gh-99113: Add PyInterpreterConfig.own_gil (gh-104204)
ericsnowcurrently May 5, 2023
0b9d0b2
gh-104144: Skip scheduling a done callback if a TaskGroup task comple…
itamaro May 5, 2023
8df75f2
gh-97696: Remove redundant #include (#104216)
jbower-fb May 5, 2023
88482c7
gh-101819: Prepare to modernize the _io extension (#104178)
vstinner May 5, 2023
810e47b
gh-102215: importlib documentation cleanups
yrro May 6, 2023
cf8ee0b
GH-97950: Use new-style index directive ('builtin') (#104164)
AA-Turner May 6, 2023
b2c254d
gh-104233: Fix "unused variable" warning in `ceval_gil.c` (#104234)
sobolevn May 6, 2023
6ab9a42
gh-65772: Clean-up turtle module (#104218)
terryjreedy May 6, 2023
b4f3496
Rewrite the turtledemo makeGraphFrame method (#104224)
terryjreedy May 6, 2023
cb70222
gh-104144: Optimize gather to finish eagerly when all futures complet…
itamaro May 6, 2023
1173ce2
gh-90953: Emit deprecation warnings for `ast` features deprecated in …
AlexWaygood May 6, 2023
a719df1
GH-103548: Improve performance of `pathlib.Path.[is_]absolute()` (GH-…
barneygale May 6, 2023
060a31e
gh-101819: Remove unused 'locale_module' from _io state (#104246)
erlend-aasland May 6, 2023
fc1e63f
gh-99113: Add a check for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-10…
ericsnowcurrently May 6, 2023
74d38ea
gh-99113: Make Sure the GIL is Acquired at the Right Places (gh-104208)
ericsnowcurrently May 6, 2023
de9f9dd
gh-101640: Make argparse _print_message catch any write error (#101802)
arhadthedev May 6, 2023
fe13226
gh-104254: Document the optional keyword-only "context" argument to T…
itamaro May 7, 2023
33e8bdb
gh-103886: Improve `builtins.__doc__` (#104179)
tomasr8 May 7, 2023
44b081d
gh-97696: Use `PyObject_CallMethodNoArgs` and inline is_loop_running …
itamaro May 7, 2023
06707b9
gh-104018: remove unused format "z" handling in string formatfloat() …
belm0 May 7, 2023
7e11146
Re-enable commented-out test in test_generators.py (#104130)
ymki4360 May 7, 2023
c66f1b6
gh-101819: Port _io.PyIncrementalNewlineDecoder_Type to heap type (#1…
erlend-aasland May 7, 2023
e63898e
gh-101819: Adapt _io.PyWindowsConsoleIO_Type to heap type (#104197)
erlend-aasland May 7, 2023
18babf4
gh-100370: fix OverflowError in sqlite3.Connection.blobopen for 32-bi…
erlend-aasland May 7, 2023
b61f7d2
gh-101819: Port _io.PyBytesIOBuffer_Type to heap type (#104264)
erlend-aasland May 7, 2023
f06a11c
GH-100479: Fix pathlib test failure on WASI (#104215)
barneygale May 7, 2023
86ca8d2
gh-103193: cache calls to `inspect._shadowed_dict` in `inspect.getatt…
AlexWaygood May 7, 2023
c195a2c
gh-104240: make _PyCompile_CodeGen support different compilation mode…
iritkatriel May 7, 2023
3145c0f
GH-89812: Churn `pathlib.Path` methods (GH-104243)
barneygale May 7, 2023
44914e0
gh-103650: Fix perf maps address format (#103651)
art049 May 7, 2023
f6943eb
GH-102613: Improve performance of `pathlib.Path.rglob()` (GH-104244)
barneygale May 7, 2023
8e76e2d
gh-104265 Disallow instantiation of `_csv.Reader` and `_csv.Writer` (…
chgnrdv May 7, 2023
67b4b55
gh-64660: Don't hardcode Argument Clinic return converter result vari…
erlend-aasland May 7, 2023
52539f0
gh-104273: Remove redundant len() calls in argparse function (#104274)
buraksaler May 7, 2023
82a37a4
gh-99108: Replace SHA3 implementation HACL* version (#103597)
msprotz May 8, 2023
2745006
gh-97696: Improve and fix documentation for asyncio eager tasks (#104…
itamaro May 8, 2023
013469f
gh-102500: Remove mention of bytes shorthand (#104281)
hauntsaninja May 8, 2023
ffa4d19
Trim trailing whitespace and test on CI (#104275)
hugovk May 8, 2023
7714382
gh-103193: Improve `getattr_static` test coverage (#104286)
AlexWaygood May 8, 2023
a7e9a63
GH-104145: Use fully-qualified cross reference types for the bisect m…
AA-Turner May 8, 2023
82bc549
gh-99108: fix typo in Modules/Setup (#104293)
msprotz May 8, 2023
b28c5f2
gh-104223: Fix issues with inheriting from buffer classes (#104227)
JelleZijlstra May 8, 2023
a49c8a8
gh-89550: Buffer GzipFile.write to reduce execution time by ~15% (#10…
CCLDArjun May 8, 2023
b8116d8
GH-104284: Fix documentation gettext build (#104296)
AA-Turner May 8, 2023
9a51482
get_coro versionchanged info and cross-reference
jbower-fb May 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# GitHub
.github/** @ezio-melotti @hugovk

# pre-commit
.pre-commit-config.yaml @hugovk @AlexWaygood

# Build system
configure* @erlend-aasland @corona10

Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint

on: [push, pull_request, workflow_dispatch]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: trailing-whitespace
types_or: [c, python, rst]
2 changes: 1 addition & 1 deletion Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Dictionary Objects

.. c:function:: Py_ssize_t PyDict_Size(PyObject *p)

.. index:: builtin: len
.. index:: pair: built-in function; len

Return the number of items in the dictionary. This is equivalent to
``len(p)`` on a dictionary.
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Importing Modules

.. c:function:: PyObject* PyImport_ImportModuleEx(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)

.. index:: builtin: __import__
.. index:: pair: built-in function; __import__

Import a module. This is best described by referring to the built-in Python
function :func:`__import__`.
Expand Down Expand Up @@ -120,7 +120,7 @@ Importing Modules

.. c:function:: PyObject* PyImport_ExecCodeModule(const char *name, PyObject *co)

.. index:: builtin: compile
.. index:: pair: built-in function; compile

Given a module name (possibly of the form ``package.module``) and a code object
read from a Python bytecode file or obtained from the built-in function
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ List Objects

.. c:function:: Py_ssize_t PyList_Size(PyObject *list)

.. index:: builtin: len
.. index:: pair: built-in function; len

Return the length of the list object in *list*; this is equivalent to
``len(list)`` on a list object.
Expand Down Expand Up @@ -138,7 +138,7 @@ List Objects

.. c:function:: PyObject* PyList_AsTuple(PyObject *list)

.. index:: builtin: tuple
.. index:: pair: built-in function; tuple

Return a new tuple object containing the contents of *list*; equivalent to
``tuple(list)``.
2 changes: 1 addition & 1 deletion Doc/c-api/mapping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` and
.. c:function:: Py_ssize_t PyMapping_Size(PyObject *o)
Py_ssize_t PyMapping_Length(PyObject *o)

.. index:: builtin: len
.. index:: pair: built-in function; len

Returns the number of keys in object *o* on success, and ``-1`` on failure.
This is equivalent to the Python expression ``len(o)``.
Expand Down
12 changes: 6 additions & 6 deletions Doc/c-api/number.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ Number Protocol

.. c:function:: PyObject* PyNumber_Divmod(PyObject *o1, PyObject *o2)

.. index:: builtin: divmod
.. index:: pair: built-in function; divmod

See the built-in function :func:`divmod`. Returns ``NULL`` on failure. This is
the equivalent of the Python expression ``divmod(o1, o2)``.


.. c:function:: PyObject* PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3)

.. index:: builtin: pow
.. index:: pair: built-in function; pow

See the built-in function :func:`pow`. Returns ``NULL`` on failure. This is the
equivalent of the Python expression ``pow(o1, o2, o3)``, where *o3* is optional.
Expand All @@ -94,7 +94,7 @@ Number Protocol

.. c:function:: PyObject* PyNumber_Absolute(PyObject *o)

.. index:: builtin: abs
.. index:: pair: built-in function; abs

Returns the absolute value of *o*, or ``NULL`` on failure. This is the equivalent
of the Python expression ``abs(o)``.
Expand Down Expand Up @@ -192,7 +192,7 @@ Number Protocol

.. c:function:: PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3)

.. index:: builtin: pow
.. index:: pair: built-in function; pow

See the built-in function :func:`pow`. Returns ``NULL`` on failure. The operation
is done *in-place* when *o1* supports it. This is the equivalent of the Python
Expand Down Expand Up @@ -238,15 +238,15 @@ Number Protocol

.. c:function:: PyObject* PyNumber_Long(PyObject *o)

.. index:: builtin: int
.. index:: pair: built-in function; int

Returns the *o* converted to an integer object on success, or ``NULL`` on
failure. This is the equivalent of the Python expression ``int(o)``.


.. c:function:: PyObject* PyNumber_Float(PyObject *o)

.. index:: builtin: float
.. index:: pair: built-in function; float

Returns the *o* converted to a float object on success, or ``NULL`` on failure.
This is the equivalent of the Python expression ``float(o)``.
Expand Down
12 changes: 6 additions & 6 deletions Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Object Protocol

.. c:function:: PyObject* PyObject_Repr(PyObject *o)

.. index:: builtin: repr
.. index:: pair: built-in function; repr

Compute a string representation of object *o*. Returns the string
representation on success, ``NULL`` on failure. This is the equivalent of the
Expand All @@ -202,7 +202,7 @@ Object Protocol

.. c:function:: PyObject* PyObject_ASCII(PyObject *o)

.. index:: builtin: ascii
.. index:: pair: built-in function; ascii

As :c:func:`PyObject_Repr`, compute a string representation of object *o*, but
escape the non-ASCII characters in the string returned by
Expand All @@ -227,7 +227,7 @@ Object Protocol

.. c:function:: PyObject* PyObject_Bytes(PyObject *o)

.. index:: builtin: bytes
.. index:: pair: built-in function; bytes

Compute a bytes representation of object *o*. ``NULL`` is returned on
failure and a bytes object on success. This is equivalent to the Python
Expand Down Expand Up @@ -278,7 +278,7 @@ Object Protocol

.. c:function:: Py_hash_t PyObject_Hash(PyObject *o)

.. index:: builtin: hash
.. index:: pair: built-in function; hash

Compute and return the hash value of an object *o*. On failure, return ``-1``.
This is the equivalent of the Python expression ``hash(o)``.
Expand Down Expand Up @@ -312,7 +312,7 @@ Object Protocol

.. c:function:: PyObject* PyObject_Type(PyObject *o)

.. index:: builtin: type
.. index:: pair: built-in function; type

When *o* is non-``NULL``, returns a type object corresponding to the object type
of object *o*. On failure, raises :exc:`SystemError` and returns ``NULL``. This
Expand All @@ -332,7 +332,7 @@ Object Protocol
.. c:function:: Py_ssize_t PyObject_Size(PyObject *o)
Py_ssize_t PyObject_Length(PyObject *o)

.. index:: builtin: len
.. index:: pair: built-in function; len

Return the length of object *o*. If the object *o* provides either the sequence
and mapping protocols, the sequence length is returned. On error, ``-1`` is
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/sequence.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Sequence Protocol
.. c:function:: Py_ssize_t PySequence_Size(PyObject *o)
Py_ssize_t PySequence_Length(PyObject *o)

.. index:: builtin: len
.. index:: pair: built-in function; len

Returns the number of objects in sequence *o* on success, and ``-1`` on
failure. This is equivalent to the Python expression ``len(o)``.
Expand Down Expand Up @@ -120,7 +120,7 @@ Sequence Protocol

.. c:function:: PyObject* PySequence_Tuple(PyObject *o)

.. index:: builtin: tuple
.. index:: pair: built-in function; tuple

Return a tuple object with the same contents as the sequence or iterable *o*,
or ``NULL`` on failure. If *o* is a tuple, a new reference will be returned,
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/set.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ or :class:`frozenset` or instances of their subtypes.

.. c:function:: Py_ssize_t PySet_Size(PyObject *anyset)

.. index:: builtin: len
.. index:: pair: built-in function; len

Return the length of a :class:`set` or :class:`frozenset` object. Equivalent to
``len(anyset)``. Raises a :exc:`PyExc_SystemError` if *anyset* is not a
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ method.

.. data:: METH_CLASS

.. index:: builtin: classmethod
.. index:: pair: built-in function; classmethod

The method will be passed the type object as the first parameter rather
than an instance of the type. This is used to create *class methods*,
Expand All @@ -357,7 +357,7 @@ method.

.. data:: METH_STATIC

.. index:: builtin: staticmethod
.. index:: pair: built-in function; staticmethod

The method will be passed ``NULL`` as the first parameter rather than an
instance of the type. This is used to create *static methods*, similar to
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)

.. c:member:: reprfunc PyTypeObject.tp_repr

.. index:: builtin: repr
.. index:: pair: built-in function; repr

An optional pointer to a function that implements the built-in function
:func:`repr`.
Expand Down Expand Up @@ -870,7 +870,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)

.. c:member:: hashfunc PyTypeObject.tp_hash

.. index:: builtin: hash
.. index:: pair: built-in function; hash

An optional pointer to a function that implements the built-in function
:func:`hash`.
Expand Down
2 changes: 1 addition & 1 deletion Doc/extending/newtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ done. This can be done using the :c:func:`PyErr_Fetch` and

.. index::
single: string; object representation
builtin: repr
pair: built-in function; repr

Object Presentation
-------------------
Expand Down
41 changes: 28 additions & 13 deletions Doc/howto/clinic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1033,19 +1033,36 @@ you're not permitted to use:
Using a return converter
------------------------

By default the impl function Argument Clinic generates for you returns ``PyObject *``.
But your C function often computes some C type, then converts it into the ``PyObject *``
By default, the impl function Argument Clinic generates for you returns
:c:type:`PyObject * <PyObject>`.
But your C function often computes some C type,
then converts it into the :c:type:`!PyObject *`
at the last moment. Argument Clinic handles converting your inputs from Python types
into native C types—why not have it convert your return value from a native C type
into a Python type too?

That's what a "return converter" does. It changes your impl function to return
some C type, then adds code to the generated (non-impl) function to handle converting
that value into the appropriate ``PyObject *``.
that value into the appropriate :c:type:`!PyObject *`.

The syntax for return converters is similar to that of parameter converters.
You specify the return converter like it was a return annotation on the
function itself. Return converters behave much the same as parameter converters;
function itself, using ``->`` notation.

For example:

.. code-block:: c

/*[clinic input]
add -> int

a: int
b: int
/

[clinic start generated code]*/

Return converters behave much the same as parameter converters;
they take arguments, the arguments are all keyword-only, and if you're not changing
any of the default arguments you can omit the parentheses.

Expand All @@ -1066,19 +1083,17 @@ Currently Argument Clinic supports only a few return converters:
.. code-block:: none

bool
double
float
int
unsigned int
long
unsigned int
size_t
Py_ssize_t
float
double
DecodeFSDefault
size_t
unsigned int
unsigned long

None of these take parameters. For the first three, return -1 to indicate
error. For ``DecodeFSDefault``, the return type is ``const char *``; return a ``NULL``
pointer to indicate an error.
None of these take parameters.
For all of these, return ``-1`` to indicate error.

To see all the return converters Argument Clinic supports, along with
their parameters (if any),
Expand Down
Loading