You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Crash on numtype numpy stubs package related to property #18764
...
File "/Users/shantanu/dev/mypy/mypy/nodes.py", line 580, in accept
return visitor.visit_overloaded_func_def(self)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 641, in visit_overloaded_func_def
self._visit_overloaded_func_def(defn)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 697, in _visit_overloaded_func_def
found_method_base_classes = self.check_method_override(defn)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 2022, in check_method_override
result = self.check_method_or_accessor_override_for_base(
defn, base, check_override_compatibility
)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 2060, in check_method_or_accessor_override_for_base
if self.check_method_override_for_base_with_name(defn, name, base):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 2194, in check_method_override_for_base_with_name
self.check_setter_type_override(defn, base_attr, base)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 2084, in check_setter_type_override
original_type, is_original_setter = get_raw_setter_type(base_node)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 8919, in get_raw_setter_type
assert var.type is not None
^^^^^^^^^^^^^^^^^^^^
AssertionError:
numtype/src/numpy-stubs/ma/core.pyi:308: : note: use --pdb to drop into pdb
Oh well, I was wandering why some code paths (inconsistently) expose settable property type as Overloaded(...) with a single item. Ultimately, this is just another case of the checkmember.py mega-issue. I am still not sure what to do about this particular case: another band-aid, or try cleaning this up for real. Taking into account the 1.16 is coming soon it will likely be the former, but I want to think a bit more, before I do this.
Activity
hauntsaninja commentedon Mar 7, 2025
Partially minimised repro:
ilevkivskyi commentedon Mar 7, 2025
Oh well, I was wandering why some code paths (inconsistently) expose settable property type as
Overloaded(...)with a single item. Ultimately, this is just another case of thecheckmember.pymega-issue. I am still not sure what to do about this particular case: another band-aid, or try cleaning this up for real. Taking into account the 1.16 is coming soon it will likely be the former, but I want to think a bit more, before I do this.ilevkivskyi commentedon Mar 8, 2025
@hauntsaninja could you please check that #18774 fixes the original crash? (I have a very minimalist example in the tests.)
Consistently store settable property type (#18774)
jorenham commentedon Mar 10, 2025
I can confirm that latest mypy main (af5186e) now indeed runs without crashing on numtype (8598dc9): Thanks, @ilevkivskyi and @hauntsaninja!