Skip to content

hash functions seem to be inconsistent with object equality #89

@thisiscam

Description

@thisiscam

Describe the bug
Hash function does not respect object equality.

To Reproduce
Steps to reproduce the behavior:

import islpy
a = islpy.MultiAff("{ [i] -> [i] }")
b = islpy.MultiAff("{ [j] -> [j] }")
print(a == b) # prints "True"
print(hash(a) == hash(b)) # prints "False"

Expected behavior
I expect the hash function to be equal when the objects are equal.

Environment (please complete the following information):

  • OS: MacOS
  • Python version: 3.8

My Observations
It seems like the islpy wrapper is requires a <obj>_get_hash function in ISL to work properly, or else will fall back to a hash of the string: https://github.com/inducer/islpy/blob/main/islpy/__init__.py#L323. I believe those get_hash functions do not go through the wrapper script for some reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions