Repository navigation
Conversation
This file contains hidden or 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
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.
Follow-up to #22139, from this review comment.
mypy types
C.propas the property's getter, so it acceptsC.prop(obj). At runtime,C.propis the property object (a getset descriptor for a native class), and calling it raisesTypeError: 'property' object is not callable. For a native class, mypyc compiledC.prop(obj)as a direct call to the getter, so it returnedobj.propinstead of raising. The same happened with inherited, read-write and trait properties, and withcls.prop(obj)in a classmethod of a class with no subclasses. If the getter was an abstract trait property with an empty body, the process aborted (Fatal Python error: Aborted).mypyc now reports an error for these calls, like the existing error for accessing an instance attribute through a class object:
#18969 would make mypy report these calls (
"property" not callable) in code that it type checks, but mypyc still needs its own check.