Skip to content

Commit ffd8df3

Browse files
committed
Drop hash fallback via string (closes gh-89)
1 parent fc9fb66 commit ffd8df3

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

islpy/__init__.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -307,23 +307,14 @@ def generic_repr(self):
307307
getattr(prn, f"print_{self._base_name}")(self)
308308
return f'{type(self).__name__}("{prn.get_str()}")'
309309

310-
def generic_hash(self):
311-
return hash((type(self), str(self)))
312-
313-
def generic_isl_hash(self):
314-
return self.get_hash()
315-
316310
for cls in ALL_CLASSES:
317311
if (hasattr(cls, "_base_name")
318312
and hasattr(Printer, f"print_{cls._base_name}")):
319313
cls.__str__ = generic_str
320314
cls.__repr__ = generic_repr
321315

322-
if not hasattr(cls, "get_hash"):
323-
cls.__hash__ = generic_hash
324-
325-
if hasattr(cls, "get_hash"):
326-
cls.__hash__ = generic_isl_hash
316+
if not hasattr(cls, "__hash__"):
317+
raise AssertionError(f"not hashable: {cls}")
327318

328319
# }}}
329320

0 commit comments

Comments
 (0)