Opened 9 years ago
Last modified 9 years ago
#27309 closed Bug
Missing Hash function in CallableBool — at Version 1
| Reported by: | Reto Aebersold | Owned by: | nobody |
|---|---|---|---|
| Component: | Utilities | Version: | 1.10 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
As CallableBool has no hash function, membership test operations for sets do not work:
from django.utils.deprecation import CallableTrue
assert CallableTrue in {True}
TypeError: unhashable type: 'CallableBool'
Adding a hash function solves this problem:
def __hash__(self):
return hash(self.value)
Change History (1)
comment:1 by , 9 years ago
| Component: | Uncategorized → Utilities |
|---|---|
| Description: | modified (diff) |
| Type: | Uncategorized → Bug |
Note:
See TracTickets
for help on using tickets.