-
-
Notifications
You must be signed in to change notification settings - Fork 488
Fix a crash on mypy master branch #2670
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
Conversation
In python/mypy#18818 the `msg` argument to `analyze_member_access()` was removed.
@sobolevn Perhaps we should also check mypy master in CI? |
|
||
# TODO: [mypy 1.16+] Remove this workaround for passing `msg` to `analyze_member_access()`. | ||
extra: dict[str, Any] = {} | ||
if "msg" in inspect.signature(analyze_member_access).parameters: # mypy < 1.16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bummer. Looks like inspect.signature()
won't work because of mypyc...
ValueError: no signature found for builtin <built-in function analyze_member_access>
|
||
from mypy_django_plugin.lib import helpers | ||
|
||
mypy_version_info = tuple(map(int, mypy_version.partition("+")[0].split("."))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to a version-based check. This is somewhat ugly, but I didn't want to add packaging
as a dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we need more mypy versions to be tested in CI, including master
one.
mypy 1.16 released now, will django-stubs cut a corresponding release with this fix soon? |
yes! |
* Fix a crash on mypy master branch In python/mypy#18818 the `msg` argument to `analyze_member_access()` was removed. * Switch to using a version-based check
cherry-picked from typeddjango#2670 Co-authored-by: Nick Pope <nick@nickpope.me.uk>
* Fix a crash on mypy master branch In python/mypy#18818 the `msg` argument to `analyze_member_access()` was removed. * Switch to using a version-based check
I have made things!
In python/mypy#18818 the
msg
argument toanalyze_member_access()
was removed.This will crash when mypy v1.16 gets released, so only pass
msg
if it is in the function signature.Related issues
N/A