Skip to content

__hash__ works only on attribute values #295

@hynek

Description

@hynek

Currently our __hash__ methods returns the hash of a tuple with all attribute values but without taking type information into account:

>>> @attr.s(hash=True)
... class C:
...     x = attr.ib()
>>> hash(C(1)) == hash((1,))
True

Oopsies!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions