]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-41756: Introduce PyGen_Send C API (GH-22196)
authorVladimir Matveev <vladima@fb.com>
Sat, 19 Sep 2020 01:38:38 +0000 (18:38 -0700)
committerGitHub <noreply@github.com>
Sat, 19 Sep 2020 01:38:38 +0000 (18:38 -0700)
commit2b05361bf7cbbd76035206fd9befe87f37489f1e
treed29b4c3ab8e617ee8f5f5440db83a2bfa3050666
parentec8a15b034124f3b58d1addda789fa4c20313006
bpo-41756: Introduce PyGen_Send C API (GH-22196)

The new API allows to efficiently send values into native generators
and coroutines avoiding use of StopIteration exceptions to signal
returns.

ceval loop now uses this method instead of the old "private"
_PyGen_Send C API. This translates to 1.6x increased performance
of 'await' calls in micro-benchmarks.

Aside from CPython core improvements, this new API will also allow
Cython to generate more efficient code, benefiting high-performance
IO libraries like uvloop.
Doc/c-api/gen.rst
Doc/data/refcounts.dat
Include/genobject.h
Misc/NEWS.d/next/Core and Builtins/2020-09-12-12-55-45.bpo-41756.1h0tbV.rst [new file with mode: 0644]
Modules/_asynciomodule.c
Objects/genobject.c
Python/ceval.c