Skip to content
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

attrs: Fix emulating hash method logic #17016

Merged
merged 2 commits into from
Mar 15, 2024

Commits on Mar 12, 2024

  1. attrs: Fix emulating hash method logic

    This commit fixes a couple regressions in 1.9.0 from 91be285.
    
    Attrs' logic for hashability is slightly complex:
    
    * https://www.attrs.org/en/stable/hashing.html
    * https://github.com/python-attrs/attrs/blob/9e443b18527dc96b194e92805fa751cbf8434ba9/src/attr/_make.py#L1660-L1689
    
    Mypy now properly emulates attrs' logic so that custom `__hash__`
    implementations are preserved, `@frozen` subclasses are always hashable,
    and classes are only made unhashable based on the values of `eq` and
    `unsafe_hash`.
    
    Fixes python#17015
    Fixes python#16556 (comment)
    
    Based on a patch in python#17012
    Co-Authored-By: Tin Tvrtkovic <tinchester@gmail.com>
    Hnasar committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    d40909e View commit details
    Browse the repository at this point in the history
  2. fixup! attrs: Fix emulating hash method logic

    Add another test for parameter precedence
    Hnasar committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    191cd9f View commit details
    Browse the repository at this point in the history