-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add return annotation to __annotations__
last
#6071
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
Add return annotation to __annotations__
last
#6071
Conversation
Functions like `functools.singledispatch` are sensitive to the order of items in the `__annotations__` map. CPython puts returns last.
WalkthroughThe change updates the Changes
Sequence Diagram(s)sequenceDiagram
participant Compiler
participant Parameters
participant Expr (Return Annotation)
Compiler->>Parameters: Iterate parameter annotations
loop For each parameter
Compiler->>Parameters: Compile annotation
end
alt If return annotation exists
Compiler->>Expr: Compile return annotation
end
Compiler-->>Compiler: Return total annotation count
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Thank you so much! To prevent regression, could you add a test about this? Adding the code described in the issue to |
Can do 🫡 |
f51bdab
to
a04f2f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Description
Functions like
functools.singledispatch
are sensitive to the order of items in the__annotations__
map. CPython puts return types last.Resolves #6068
Note: I'd prefer to include automated tests from CPython alongside this, but struggled. There are tests from Python 3.13.5's
test_importlib/
which will fail without commit, as they make use ofsingledispatch
that would serve to test this code change on every release.Test script
RustPython before
## CPython
RustPython after
Summary by CodeRabbit