-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Revert "Fix callable instance variable support (#10548)" #11571
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 6ab0efc. Reverting the change since it causes a significant backward compatibility break. Code like this previously worked as expected: ``` class C: def f(self) -> None: pass g = f C().g() ``` However, #10548 broke this in a subtle way (no error on definition), and instead required the introduction of a ClassVar annotation for `g`, which is non-intuitive and error-prone. For example, some typeshed stubs use method aliases such as the above (e.g. stubs for `logging`), and the change broke those stubs. It's also arguably inconsistent, since normally ClassVar annotations are optional. Any fix to the original issue should avoid breaking method aliases such as the above. Hopefully the fix can be adjusted suitably. The PR may have broken incremental mode somehow as well -- cached and uncached runs sometimes produce different results. The root cause is still unclear, however.
ilevkivskyi
approved these changes
Nov 17, 2021
Diff from mypy_primer, showing the effect of this PR on open source code: pydantic (https://github.com/samuelcolvin/pydantic.git)
- pydantic/validators.py:503: error: Unused "type: ignore" comment
sphinx (https://github.com/sphinx-doc/sphinx.git)
- sphinx/domains/std.py: note: In member "handle_signature" of class "GenericObject":
- sphinx/domains/std.py:58:20: error: Too few arguments
- sphinx/domains/std.py:58:36: error: Argument 1 has incompatible type "BuildEnvironment"; expected "GenericObject"
- sphinx/domains/std.py:58:46: error: Argument 2 has incompatible type "str"; expected "BuildEnvironment"
- sphinx/domains/std.py:58:51: error: Argument 3 has incompatible type "desc_signature"; expected "str"
graphql-core (https://github.com/graphql-python/graphql-core.git)
- src/graphql/execution/execute.py:216: error: Unused "type: ignore" comment
- src/graphql/execution/execute.py:217: error: Unused "type: ignore" comment
- src/graphql/execution/execute.py:807: error: Unused "type: ignore" comment
|
This was referenced Nov 17, 2021
JukkaL
added a commit
that referenced
this pull request
Nov 17, 2021
This reverts commit 6ab0efc. Reverting the change since it causes a significant backward compatibility break. Code like this previously worked as expected: ``` class C: def f(self, ...) -> None: pass g = f C().g(...) # Now sometimes generates an error ``` However, #10548 broke this in a subtle way (no error on definition, it sometimes generates an error on call), and instead required the introduction of a ClassVar annotation for `g`, which is non-intuitive and error-prone. For example, some typeshed stubs use method aliases such as the above (e.g. stubs for `logging`), and the change broke those stubs. It's also arguably inconsistent, since normally ClassVar annotations are optional. Any fix to the original issue should avoid breaking method aliases such as the above. Hopefully the fix can be adjusted suitably. The PR may have broken incremental mode somehow as well -- cached and uncached runs sometimes produce different results. The root cause is still unclear, however.
tushar-deepsource
pushed a commit
to DeepSourceCorp/mypy
that referenced
this pull request
Jan 20, 2022
…n#11571) This reverts commit 6ab0efc. Reverting the change since it causes a significant backward compatibility break. Code like this previously worked as expected: ``` class C: def f(self, ...) -> None: pass g = f C().g(...) # Now sometimes generates an error ``` However, python#10548 broke this in a subtle way (no error on definition, it sometimes generates an error on call), and instead required the introduction of a ClassVar annotation for `g`, which is non-intuitive and error-prone. For example, some typeshed stubs use method aliases such as the above (e.g. stubs for `logging`), and the change broke those stubs. It's also arguably inconsistent, since normally ClassVar annotations are optional. Any fix to the original issue should avoid breaking method aliases such as the above. Hopefully the fix can be adjusted suitably. The PR may have broken incremental mode somehow as well -- cached and uncached runs sometimes produce different results. The root cause is still unclear, however.
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 6ab0efc.
Reverting the change since it causes a significant backward
compatibility break. Code like this previously worked as expected:
However, #10548 broke this in a subtle way (no error on definition,
it sometimes generates an error on call), and instead required the
introduction of a ClassVar annotation for
g
, which is non-intuitiveand error-prone. For example, some typeshed stubs use method
aliases such as the above (e.g. stubs for
logging
), and the changebroke those stubs. It's also arguably inconsistent, since normally
ClassVar annotations are optional.
Any fix to the original issue should avoid breaking method aliases
such as the above. Hopefully the fix can be adjusted suitably.
The PR may have broken incremental mode somehow as well -- cached
and uncached runs sometimes produce different results. The root
cause is still unclear, however.