mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:09:22 +00:00
[red-knot] TypedDict: No errors for introspection dunder attributes (#17677)
## Summary Do not emit errors when accessing introspection dunder attributes such as `__required_keys__` on `TypedDict`s.
This commit is contained in:
parent
ceb2bf1168
commit
92f95ff494
2 changed files with 4 additions and 3 deletions
|
@ -21,4 +21,7 @@ msg = Message(id=1, content="Hello")
|
|||
|
||||
# No errors for yet-unsupported features (`closed`):
|
||||
OtherMessage = TypedDict("OtherMessage", {"id": int, "content": str}, closed=True)
|
||||
|
||||
reveal_type(Person.__required_keys__) # revealed: @Todo(TypedDict)
|
||||
reveal_type(Message.__required_keys__) # revealed: @Todo(TypedDict)
|
||||
```
|
||||
|
|
|
@ -169,9 +169,7 @@ impl<'db> ClassBase<'db> {
|
|||
KnownInstanceType::OrderedDict => {
|
||||
Self::try_from_type(db, KnownClass::OrderedDict.to_class_literal(db))
|
||||
}
|
||||
KnownInstanceType::TypedDict => {
|
||||
Self::try_from_type(db, KnownClass::Dict.to_class_literal(db))
|
||||
}
|
||||
KnownInstanceType::TypedDict => Self::try_from_type(db, todo_type!("TypedDict")),
|
||||
KnownInstanceType::Callable => {
|
||||
Self::try_from_type(db, todo_type!("Support for Callable as a base class"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue