Bug Report mypy is ignoring a manually-written __hash__ method in an attrs class. Bisect points to 91be285 causing the regression. cc @Tinche Possibly reported already in a comment here? #16556 (comment)
To Reproduce
import attrs from typing import reveal_type @attrs.define() class A(): name: str = attrs.field() def __hash__(self) -> int: return hash(self.name) reveal_type(A.__hash__)
Expected Behavior
$ py -m mypy --strict foo.py # 1.8 foo.py:10: note: Revealed type is "def (self: foo.A) -> builtins.int" $ py foo.py Runtime type is 'function'
Actual Behavior
$ py -m mypy --strict foo.py # 1.9 foo.py:10: note: Revealed type is "None" $ py foo.py Runtime type is 'function'
Your Environment
I'll take this.
Fix attrs hashability detection
attrs: Fix emulating hash method logic
attrs: Fix emulating hash method logic (#17016)
Activity
Tinche commented on Mar 11, 2024
I'll take this.
Fix attrs hashability detection
Fix attrs hashability detection
attrs: Fix emulating hash method logic
attrs: Fix emulating hash method logic
attrs: Fix emulating hash method logic
attrs: Fix emulating hash method logic
attrs: Fix emulating hash method logic (#17016)