<div dir="ltr"><div dir="ltr"><div>Hi all,</div><div><br></div><div><div>I am investigating a migration to Python 3, and to facilitate this we are using the -3 flag as decribed here: <a href="https://docs.python.org/3/howto/pyporting.html#prevent-compatibility-regressions" target="_blank">https://docs.python.org/3/<wbr>howto/pyporting.html#prevent-<wbr>compatibility-regressions</a> . When using this flag I encountered some issues inside of mock itself.</div><div><br></div><div>Python 3 now requires you to implement `__hash__` if you implement `__eq__`. See <a href="https://docs.python.org/3.6/reference/datamodel.html#object.%5F%5Fhash%5F%5F" target="_blank">https://docs.python.org/3.6/<wbr>reference/datamodel.html#<wbr>object.%5F%5Fhash%5F%5F</a> .</div><div><br></div><div>```python</div><div>{mock.ANY}  # Fine in Python 2, Throws in Python 3</div><div>```</div><div><br></div><div>We need to explicitly sets the `__hash__` method on these objects as `None` to ensure the behavior is consistent in Python 3 as well as Python 2.<br></div></div><div><br></div><div>I&#39;ve put up a PR to fix this at <a href="https://github.com/testing-cabal/mock/pull/378" target="_blank">https://github.com/testing-<wbr>cabal/mock/pull/378</a> , but I am unsure if this is the correct source of truth for Mock.</div><div><br></div><div>Thanks,</div><div>Roy</div><div><br></div></div></div>