[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__

2016-09-25 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__

2016-09-25 Thread Roy Williams

Roy Williams added the comment:

OK, let's close this issue and I'll ping the TIP thread/this issue again.

On Sun, Sep 25, 2016, 11:16 AM Ned Batchelder 
wrote:

>
> Ned Batchelder added the comment:
>
> Roy, the code on GitHub isn't a literal copy of the Python 3 code, since
> it uses six, "from __future__ import", conditional imports of builtins, and
> so on.
>
> This can be fixed in GitHub.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__

2016-09-25 Thread Ned Batchelder

Ned Batchelder added the comment:

Roy, the code on GitHub isn't a literal copy of the Python 3 code, since it 
uses six, "from __future__ import", conditional imports of builtins, and so on.

This can be fixed in GitHub.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__

2016-09-25 Thread Antti Haapala

Antti Haapala added the comment:

Well, as far as I understand, this is a bug in the backport only. The Python 
2.6+ backport does not behave identically to Python 3 code in Python 2, unless 
`__hash__ = None` is added. unittest.mock in Python 3 is not affected in any 
way.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__

2016-09-25 Thread Roy Williams

Roy Williams added the comment:

Hey Antti

My understanding is the version available on PyPi is now a strict backport
of what's in Python 3, so they suggested filling the bug in bugs.python.org
so it can be backported.

http://lists.idyll.org/pipermail/testing-in-python/2016-September/006864.html

Thanks,
Roy

On Sep 25, 2016 4:24 AM, "Antti Haapala"  wrote:

>
> Antti Haapala added the comment:
>
> So you mean that unittest.mock should explicitly set `__hash__ = None`;
> but this is already what the unittest.mock does, in Python 3; there is no
> need to set `__hash__ = None`; it is the backport that needs to do this in
> order to stay compatible. There is no mock.py in 2.7.
>
> --
> nosy: +ztane
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__

2016-09-25 Thread Antti Haapala

Antti Haapala added the comment:

So you mean that unittest.mock should explicitly set `__hash__ = None`; but 
this is already what the unittest.mock does, in Python 3; there is no need to 
set `__hash__ = None`; it is the backport that needs to do this in order to 
stay compatible. There is no mock.py in 2.7.

--
nosy: +ztane

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__

2016-09-24 Thread Ned Batchelder

Changes by Ned Batchelder :


--
nosy: +nedbat

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__

2016-09-23 Thread Roy Williams

Changes by Roy Williams :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__

2016-09-23 Thread Roy Williams

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com