Skip to content

Conversation

@moreal
Copy link
Contributor

@moreal moreal commented Jan 22, 2026

No description provided.

Co-Authored-By: CPython Developers <>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

Code has been automatically formatted

The code in this PR has been formatted using:

  • cargo fmt --all
    Please pull the latest changes before pushing again:
git pull origin update-3.14.2-types

@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2026

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

Click to expand dependency information
[+] lib: cpython/Lib/_opcode_metadata.py
soft_deps:
- [ ] _opcode_metadata

[+] lib: cpython/Lib/pydoc_data
soft_deps:
- [ ] pydoc_data

[+] lib: cpython/Lib/types.py
[+] test: cpython/Lib/test/test_types.py
soft_deps:
- [x] types

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated
  • native: Rust/C extension modules

@moreal moreal force-pushed the update-3.14.2-types branch from 1e5e723 to b25479a Compare January 22, 2026 06:22
moreal and others added 4 commits January 22, 2026 17:52
- Add ITERABLE_COROUTINE (0x0100) to CodeFlags in bytecode.rs
- Update frame.rs to check for both COROUTINE and ITERABLE_COROUTINE flags
  when validating 'yield from' on coroutine objects
- Remove False and workaround in types.coroutine() now that the flag is supported
- Remove @unittest.expectedFailure from test_async_def and test_genfunc

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Generators decorated with @types.coroutine have the CO_ITERABLE_COROUTINE
flag set, making them awaitable. The GetAwaitable instruction now properly
handles this case instead of only checking for __await__ method.

This fixes the "object generator can't be used in 'await' expression" error
that occurred with asyncio.sleep(0) which uses @types.coroutine decorated
__sleep0() generator internally.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Generators decorated with @types.coroutine have the CO_ITERABLE_COROUTINE
flag and can be used in await expressions. The PyAnextAwaitable's
get_awaitable_iter method was missing this check, causing builtin anext()
to fail with "object generator can't be used in 'await' expression" when
used with such generators.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
For generators without CO_ITERABLE_COROUTINE flag, try to get __await__
method instead of returning an error immediately. This matches CPython's
_PyCoro_GetAwaitableIter behavior which allows generator subclasses that
define __await__ to be used in await expressions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@moreal moreal force-pushed the update-3.14.2-types branch from df2a9ce to b76dde1 Compare January 22, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant