New submission from Roy Williams:

I am investigating a migration to Python 3, and to facilitate this we are using 
the -3 flag as decribed here: 
https://docs.python.org/3/howto/pyporting.html#prevent-compatibility-regressions
 . When using this flag I encountered
some issues inside of mock itself.

Python 3 now requires you to implement __hash__ if you implement __eq__. See 
https://docs.python.org/3.6/reference/datamodel.html#object.%5F%5Fhash%5F%5F .

{mock.ANY}  # Fine in Python 2, Throws in Python 3

I've created a PR that explicitly sets the __hash__ method on these objects as 
None to ensure the behavior is consistent in Python 3 as well as Python 2.  The 
folks over at testing-in-python suggested I submit a bug here first and then 
the fix can be backported to testing-cabal/mock

https://github.com/testing-cabal/mock/pull/378

----------
components: Library (Lib)
messages: 277290
nosy: Roy Williams
priority: normal
severity: normal
status: open
title: mock._Any and mock._Call implement __eq__ but not __hash__
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28260>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to