Skip to content
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

Fixed bug that results in incorrect type narrowing on assignment if t… #9154

Merged
merged 1 commit into from
Oct 6, 2024

Conversation

erictraut
Copy link
Collaborator

…he narrowed type is Self or another bound type variable. This addresses #9147.

…he narrowed type is `Self` or another bound type variable. This addresses #9147.
Copy link
Contributor

github-actions bot commented Oct 6, 2024

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

pydantic (https://github.com/pydantic/pydantic)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_model_construction.py:153:17 - error: Cannot assign to attribute "__pydantic_custom_init__" for class "ModelMetaclass*"
+     Attribute "__pydantic_custom_init__" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_model_construction.py:154:17 - error: Cannot assign to attribute "__pydantic_post_init__" for class "ModelMetaclass*"
+     Attribute "__pydantic_post_init__" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_model_construction.py:154:54 - error: Cannot access attribute "model_post_init" for class "ModelMetaclass*"
+     Attribute "model_post_init" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_model_construction.py:156:17 - error: Cannot assign to attribute "__pydantic_decorators__" for class "ModelMetaclass*"
+     Attribute "__pydantic_decorators__" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_model_construction.py:160:21 - error: Cannot assign to attribute "__pydantic_generic_metadata__" for class "ModelMetaclass*"
+     Attribute "__pydantic_generic_metadata__" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_model_construction.py:201:21 - error: Cannot assign to attribute "__pydantic_generic_metadata__" for class "ModelMetaclass*"
+     Attribute "__pydantic_generic_metadata__" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_model_construction.py:207:17 - error: Cannot assign to attribute "__pydantic_complete__" for class "ModelMetaclass*"
+     Attribute "__pydantic_complete__" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_model_construction.py:215:21 - error: Cannot assign to attribute "__pydantic_parent_namespace__" for class "ModelMetaclass*"
+     Attribute "__pydantic_parent_namespace__" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_model_construction.py:237:17 - error: Cannot assign to attribute "__pydantic_computed_fields__" for class "ModelMetaclass*"
+     Attribute "__pydantic_computed_fields__" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_model_construction.py:238:43 - error: Cannot access attribute "__pydantic_decorators__" for class "ModelMetaclass*"
+     Attribute "__pydantic_decorators__" is unknown (reportAttributeAccessIssue)
- 263 errors, 45 warnings, 0 informations 
+ 273 errors, 45 warnings, 0 informations 

pip (https://github.com/pypa/pip)
- /tmp/mypy_primer/projects/pip/src/pip/_vendor/packaging/specifiers.py
-   /tmp/mypy_primer/projects/pip/src/pip/_vendor/packaging/specifiers.py:360:46 - error: Cannot access attribute "_canonical_spec" for class "object"
-     Attribute "_canonical_spec" is unknown (reportAttributeAccessIssue)
- 1819 errors, 48 warnings, 0 informations 
+ 1818 errors, 48 warnings, 0 informations 

packaging (https://github.com/pypa/packaging)
- /tmp/mypy_primer/projects/packaging/src/packaging/specifiers.py
-   /tmp/mypy_primer/projects/packaging/src/packaging/specifiers.py:360:46 - error: Cannot access attribute "_canonical_spec" for class "object"
-     Attribute "_canonical_spec" is unknown (reportAttributeAccessIssue)
- 30 errors, 0 warnings, 0 informations 
+ 29 errors, 0 warnings, 0 informations 

@erictraut erictraut merged commit 1af4b93 into main Oct 6, 2024
18 checks passed
@erictraut erictraut deleted the issue-9147 branch October 6, 2024 03:45
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.

1 participant