Skip to content

Updating a read-only TypedDict item via .update(…) should be forbidden #3098

@sharkdp

Description

@sharkdp

Emit a diagnostic if "a TypedDict with a read-only item is updated with another TypedDict that declares that key.". See this conformance test:

class A(TypedDict):
    x: ReadOnly[int]
    y: int


a1: A = {"x": 1, "y": 2}
a2: A = {"x": 3, "y": 4}
a1.update(a2)  # E

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions