Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.2k
Support usage oftype
withtyping.Self
and type aliases#10621
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
type[Self]
type[Self]
; add typecheck fortype[]
type[Self]
; add typecheck fortype[]
type[Self]
; check the content oftype[]
is a classcodspeed-hqbot commentedOct 14, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
CodSpeed Performance ReportMerging#10621 willnot alter performanceComparing Summary
|
github-actionsbot commentedOct 14, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Coverage reportClick to see where and how coverage changed
This report was generated bypython-coverage-comment-action |
type[Self]
; check the content oftype[]
is a classtype[Self]
andtype[TypeAliasType(...)]
type[Self]
andtype[TypeAliasType(...)]
type[Self]
andtype[TypeAliasType(...)]
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.
Thanks for looking at this!
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
type[Self]
andtype[TypeAliasType(...)]
type
withtyping.Self
and type aliasesCo-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
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.
Looking good, nice work on the tests.
Wanted to resolve some questions about the_typing_extra.eval_type
call - perhaps we could jump right to a type alias schema if one is detected...
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
kc0506 commentedOct 16, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I tried this snippet in Python 3.8, 3.10 and 3.12. Something interesting happed. tp=List['int']tp_eval=typing._eval_type(tp,globals(),locals())print(typing.get_args(tp))print(typing.get_args(tp_eval))tp=list['int']tp_eval=typing._eval_type(tp,globals(),locals())print(typing.get_args(tp))print(typing.get_args(tp_eval)) The results are:
So this means (only?) when user annotate with |
This was done inpython/cpython#30900. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
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.
Thanks!
f0002fc
intopydantic:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Change Summary
Fix errors caused by these:
Related issue number
fix#10618
Checklist