| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Nice! The mypy primer error message change in mongo-python-driver looks odd though -- do you know what is going on there?
Sorry, something went wrong.
| == | ||
| main:3: error: Property "f" defined in "A" is read-only | ||
|
|
||
| [case testMethodMakeBoundFineGrained] |
There was a problem hiding this comment.
Add also normal incremental mode (serialization) tests case?
Sorry, something went wrong.
| x1 = A.f | ||
| x2 = A.g | ||
| x3 = A().f | ||
| x4 = A().g |
There was a problem hiding this comment.
Would it make sense to test @staticmethod as well?
Sorry, something went wrong.
There was a problem hiding this comment.
And maybe normal attribute with an explicit annotated Callable type?
Sorry, something went wrong.
There was a problem hiding this comment.
Static methods are actually unrelated to this story, they are already handled using special-casing here https://github.com/python/mypy/blob/master/mypy/checker.py#L4420-L4422. But I still added the tests, because existing tests only cover static method alias within same class. (Also attributes with explicit callable annotations are considered instance attributes, but anyway added for completeness.)
Sorry, something went wrong.
Yes, the same thing that is going on in check-classes.test. Using object_type in messages.py instead of bound_args[0] is not a 1:1 change, but IMO new messages are equally good. |
Sorry, something went wrong.
|
Diff from mypy_primer, showing the effect of this PR on open source code: prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/threads.py:37: error: Attribute function "_counter" with type "Callable[[], int]" does not accept self argument [misc]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/runtime.py:370: error: Unused "type: ignore" comment [unused-ignore]
+ src/jinja2/runtime.py:384: error: Unused "type: ignore" comment [unused-ignore]
+ src/jinja2/environment.py:1290: error: Unused "type: ignore" comment [unused-ignore]
+ src/jinja2/environment.py:1311: error: Unused "type: ignore" comment [unused-ignore]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- pymongo/synchronous/cursor.py:1004: error: Invalid index type "int | Any | Pattern[Any]" for "list[Any]"; expected type "SupportsIndex" [index]
+ pymongo/synchronous/cursor.py:1004: error: Invalid index type "int | Any | Pattern[Any]" for "list"; expected type "SupportsIndex" [index]
- pymongo/asynchronous/cursor.py:1006: error: Invalid index type "int | Any | Pattern[Any]" for "list[Any]"; expected type "SupportsIndex" [index]
+ pymongo/asynchronous/cursor.py:1006: error: Invalid index type "int | Any | Pattern[Any]" for "list"; expected type "SupportsIndex" [index]
|
Sorry, something went wrong.
|
Thanks! |
Sorry, something went wrong.
Fixes #18438 Fixes #19146 Surprisingly, a very small change is sufficient to replicate Python runtime behavior for all the important cases (see `checkmember.py`). I also replace the `bound_args` argument of `CallableType`, that was mostly unused, with a flag (as suggested by @JukkaL) and make sure it is properly set/preserved everywhere.
| Back | FazBrowse Home | New Git URL |
Fixes #18438
Fixes #19146
Surprisingly, a very small change is sufficient to replicate Python runtime behavior for all the important cases (see checkmember.py). I also replace the bound_args argument of CallableType, that was mostly unused, with a flag (as suggested by @JukkaL) and make sure it is properly set/preserved everywhere.