-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
assigning to __annotations__ has no effect in 3.14.0b1 under from __future__ import annotations #133778
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
Comments
if this is a supported pattern (which I wasn't sure if it was or not) then I assume some tests will be added, thanks! |
Yes it is, we are not testing the |
thanks! Here's hoping for a much more boring 3.14.0b2 release :) |
Yes! I'm hoping to get all the fixes in over the weekend, after that I can try to run the SQLAlchemy test suite to make sure it's all fixed. |
thanks. It's not that SQLAlchemy is doing everything great, or correctly, or what it said is allowed on the label, but at least it's a way to trap changes in behavior which you can then look at on a case by case basis to see if these changes were intended. |
I'd like to ask for other opinions here (maybe @carljm @larryhastings) so I'm going to try to explain the situation. Currently, classes with and without
When reading annotations ( The background for this is described in https://peps.python.org/pep-0749/#annotations-and-metaclasses. When you set annotations on a type, I'm considering a few options for how to solve this:
So I'd like to go with option (2). |
Bug report
Bug description:
this works in 3.14.0a7, has no effect in 3.14.0b1. there seems to be a new attribute
__annotations_cache__
that the assignment goes into but it isn't returned from__annotations__
:If there's a way to get annotationlib.get_annotations() to pick up the change I can use that as a workaround
cc @JelleZijlstra
CPython versions tested on:
3.14
Operating systems tested on:
No response
Linked PRs
__annotations__
under PEP 563 #133794The text was updated successfully, but these errors were encountered: