django-stubs
django-stubs copied to clipboard
regression in 5.2.1 -- ResolverMatch is no longer iterable
Bug report
regressed in #2635 cc @UnknownPlatypus
What's wrong
https://github.com/getsentry/sentry/blob/fdd78facb166e55f73854d39ff9b89d3df9ff62a/src/sentry/api/client.py#L54-L55
now getting:
src/sentry/api/client.py:55: error: "ResolverMatch" object is not iterable [misc]
src/sentry/api/client.py:107: error: Cannot determine type of "callback" [has-type]
src/sentry/api/client.py:107: error: Cannot determine type of "callback_args" [has-type]
src/sentry/api/client.py:107: error: Cannot determine type of "callback_kwargs" [has-type]
How is that should be
no errors
System information
- OS:
pythonversion: 3.13.1djangoversion: 5.2.1mypyversion: 1.15.0django-stubsversion: 5.2.1 (forked)django-stubs-extversion: 5.2.1 (forked)
The unpacking of a ResolverMatch works only through __getitem__, but it seems that Mypy doesn't understand this. I think we should restore the __iter__ method for the time being, and report upstream?
Yes, this seems like a viable hack. Thanks, @adamchainz! Will you or @asottile-sentry please send a PR?
on it, will link https://github.com/python/mypy/issues/2220