-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Update types from v3.14.2 #6833
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
base: main
Are you sure you want to change the base?
Conversation
Co-Authored-By: CPython Developers <>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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. Comment |
|
Code has been automatically formatted The code in this PR has been formatted using:
git pull origin update-3.14.2-types |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: Click to expand dependency informationLegend:
|
1e5e723 to
b25479a
Compare
- 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>
df2a9ce to
b76dde1
Compare
No description provided.