KEMBAR78
Allow TypedDict assignment of Required item to NotRequired ReadOnly item by brianschubert · Pull Request #18164 · python/mypy · GitHub
Skip to content

Conversation

brianschubert
Copy link
Member

Fixes #18162

@brianschubert
Copy link
Member Author

With this, mypy passes the typeddicts_readonly_consistency conformance tests 🎉

diff --git a/conformance/results/mypy/typeddicts_readonly_consistency.toml b/conformance/results/mypy/typeddicts_readonly_consistency.toml
index ea01b2d..cff41c9 100644
--- a/conformance/results/mypy/typeddicts_readonly_consistency.toml
+++ b/conformance/results/mypy/typeddicts_readonly_consistency.toml
@@ -6,13 +6,11 @@ output = """
 typeddicts_readonly_consistency.py:37: error: Incompatible types in assignment (expression has type "A1", variable has type "B1")  [assignment]
 typeddicts_readonly_consistency.py:38: error: Incompatible types in assignment (expression has type "C1", variable has type "B1")  [assignment]
 typeddicts_readonly_consistency.py:40: error: Incompatible types in assignment (expression has type "A1", variable has type "C1")  [assignment]
-typeddicts_readonly_consistency.py:79: error: Incompatible types in assignment (expression has type "C2", variable has type "A2")  [assignment]
 typeddicts_readonly_consistency.py:81: error: Incompatible types in assignment (expression has type "A2", variable has type "B2")  [assignment]
 typeddicts_readonly_consistency.py:82: error: Incompatible types in assignment (expression has type "C2", variable has type "B2")  [assignment]
 typeddicts_readonly_consistency.py:84: error: Incompatible types in assignment (expression has type "A2", variable has type "C2")  [assignment]
 typeddicts_readonly_consistency.py:85: error: Incompatible types in assignment (expression has type "B2", variable has type "C2")  [assignment]
 """
-conformance_automated = "Fail"
+conformance_automated = "Pass"
 errors_diff = """
-Line 79: Unexpected errors ['typeddicts_readonly_consistency.py:79: error: Incompatible types in assignment (expression has type "C2", variable has type "A2")  [assignment]']
 """
diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml
index bdefc8c..7aa48eb 100644
--- a/conformance/results/mypy/version.toml
+++ b/conformance/results/mypy/version.toml
@@ -1,2 +1,2 @@
-version = "mypy 1.13.0"
-test_duration = 2.7
+version = "mypy 1.14.0+dev.4e88ddb672cd5eef3be48cf8bbfe641969b860ac"
+test_duration = 4.7

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

discord.py (https://github.com/Rapptz/discord.py): 1.40x slower (299.8s -> 419.7s in a single noisy sample)

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@hauntsaninja hauntsaninja merged commit 87998c8 into python:master Nov 19, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arg-type error duck typing a TypedDict with NotRequired field

2 participants