jansel / opentuner

An extensible framework for program autotuning
http://opentuner.org/
MIT License
382 stars 112 forks source link

Hashlib bug when using Python 3 #134

Closed thiagotei closed 4 years ago

thiagotei commented 5 years ago

I'm getting this error when running with Python 3.5:

"opentuner/search/manipulator.py", line 858, in hash_value
    return hashlib.sha256(repr(self._get(config))).hexdigest()
TypeError: Unicode-objects must be encoded before hashing

It looks like that for the PrimitiveParameter it was fixed, but for the ComplexParameter it is missing the encode().

-- Thiago

thiagotei commented 5 years ago

The fix for here would be:

return hashlib.sha256(repr(self.get_value(config)).encode('utf-8')).hexdigest().encode('utf-8')
jansel commented 4 years ago

Thanks are you able to submit a pull request for this fix?

thiagotei commented 4 years ago

Yes. I’ll do that. (Closing and reopening this was not intentional. Clicked on the wrong button.)

ghisloine commented 3 years ago

Hello, code updated in repo but pip still install old version which has still TypeError. FYI

thiagotei commented 3 years ago

Yeah, @jansel could you update pip's version?

jansel commented 3 years ago

Sorry about that. I just updated the pip version.