X Tutup
Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
46491ba
Initial proof-of-concept for yielding synchronous functions.
ZeroIntensity Mar 7, 2026
075a6ab
Get the parser working with "async yield from".
ZeroIntensity Mar 7, 2026
67783c0
Fix the symtable and other things.
ZeroIntensity Mar 7, 2026
fd254b4
Get things somewhat working in the eval loop.
ZeroIntensity Mar 7, 2026
a6f9c5f
Yay it mostly works.
ZeroIntensity Mar 7, 2026
c37cb05
Fix exception handling.
ZeroIntensity Mar 7, 2026
8cb5166
Support return values in async yield from.
ZeroIntensity Mar 7, 2026
17eea03
Remove tests for async gen syntax restrictions.
ZeroIntensity Mar 7, 2026
923305e
Fix more tests.
ZeroIntensity Mar 7, 2026
24603b1
Merge branch 'main' of https://github.com/python/cpython into async-y…
ZeroIntensity Mar 7, 2026
c3b318e
Fix `async yield from` on non-iterator iterable objects in async gens
johnslavik Mar 7, 2026
6145c26
Merge pull request #7 from johnslavik/hyperawait-secret-conspiracy
ZeroIntensity Mar 7, 2026
b64b563
Add tests
johnslavik Mar 9, 2026
8346a0c
Ignore `test_async_yield_from` in Ruff
johnslavik Mar 9, 2026
fa53189
Remove unnecessary `aiter()`
johnslavik Mar 9, 2026
3bfc2da
Fix commented out `test_delegating_generators_claim_to_be_running_wit…
johnslavik Mar 9, 2026
bb59a0f
Merge pull request #8 from johnslavik/hyperawait-secret-conspiracy-tests
ZeroIntensity Mar 9, 2026
6f9877e
Fix a problem in CLEANUP_ASYNC_THROW I think.
ZeroIntensity Mar 9, 2026
7d033a7
Fix a small refleak.
ZeroIntensity Mar 9, 2026
ff55764
Fix missing incref.
ZeroIntensity Mar 9, 2026
85c1087
Remove unused variable.
ZeroIntensity Mar 9, 2026
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: 2 additions & 1 deletion Grammar/python.gram
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ simple_stmt[stmt_ty] (memo):
| &'raise' raise_stmt
| &'pass' pass_stmt
| &'del' del_stmt
| &'yield' yield_stmt
| &('yield' | 'async') yield_stmt
| &'assert' assert_stmt
| &'break' break_stmt
| &'continue' continue_stmt
Expand Down Expand Up @@ -724,6 +724,7 @@ if_expression[expr_ty]:
yield_expr[expr_ty]:
| 'yield' 'from' a=expression { _PyAST_YieldFrom(a, EXTRA) }
| 'yield' a=[star_expressions] { _PyAST_Yield(a, EXTRA) }
| 'async' 'yield' 'from' a=expression { _PyAST_AsyncYieldFrom(a, EXTRA) }

star_expressions[expr_ty]:
| a=star_expression b=(',' c=star_expression { c })+ [','] {
Expand Down
5 changes: 5 additions & 0 deletions Include/cpython/pyerrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ typedef struct {
PyObject *value;
} PyStopIterationObject;

typedef struct {
PyException_HEAD
PyObject *value;
} PyStopAsyncIterationObject;

typedef struct {
PyException_HEAD
PyObject *name;
Expand Down
16 changes: 11 additions & 5 deletions Include/internal/pycore_ast.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Include/internal/pycore_ast_state.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Include/internal/pycore_genobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);

PyAPI_FUNC(PyObject *)_PyCoro_GetAwaitableIter(PyObject *o);
PyAPI_FUNC(PyObject *)_PyAsyncGenValueWrapperNew(PyThreadState *state, PyObject *);
PyAPI_FUNC(PyObject *)_PyAsyncGenYieldFrom_New(PyThreadState *state, PyObject *);

extern PyTypeObject _PyCoroWrapper_Type;
extern PyTypeObject _PyAsyncGenWrappedValue_Type;
extern PyTypeObject _PyAsyncGenAThrow_Type;
extern PyTypeObject _PyAsyncGenYieldFrom_Type;

#ifdef __cplusplus
}
Expand Down
3 changes: 2 additions & 1 deletion Include/internal/pycore_intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
#define INTRINSIC_TYPEVARTUPLE 9
#define INTRINSIC_SUBSCRIPT_GENERIC 10
#define INTRINSIC_TYPEALIAS 11
#define INSTRINSIC_ASYNC_GEN_WRAP_YIELD_FROM 12

#define MAX_INTRINSIC_1 11
#define MAX_INTRINSIC_1 12


/* Binary Functions: */
Expand Down
3 changes: 2 additions & 1 deletion Include/internal/pycore_magic_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ Known values:
Python 3.15a4 3659 (Add CALL_FUNCTION_EX specialization)
Python 3.15a4 3660 (Change generator preamble code)
Python 3.15a4 3661 (Lazy imports IMPORT_NAME opcode changes)
Python 3.15a6 3662 (Asynchronous yield from changes)
Python 3.16 will start with 3700
Expand All @@ -305,7 +306,7 @@ PC/launcher.c must also be updated.
*/

#define PYC_MAGIC_NUMBER 3661
#define PYC_MAGIC_NUMBER 3662
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
(little-endian) and then appending b'\r\n'. */
#define PYC_MAGIC_NUMBER_TOKEN \
Expand Down
29 changes: 23 additions & 6 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading
X Tutup