[issue1617161] Instance methods compare equal when their self's are equal

2018-07-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> 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



[issue1617161] Instance methods compare equal when their self's are equal

2018-07-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ac20e0f98d6727ba97a9575bfa2a11b2f6247c35 by Serhiy Storchaka in 
branch 'master':
bpo-1617161: Make the hash and equality of methods not depending on the value 
of self. (GH-7848)
https://github.com/python/cpython/commit/ac20e0f98d6727ba97a9575bfa2a11b2f6247c35


--

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2018-06-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 7848 is based on method_compare.diff and 1617161_test_update.diff, but also 
makes types.MethodWrapperType unorderable, adds more tests and fixes some 
outdated tests.

This change can be considered as a bugfix, but since it can break the user code 
(unlikely), it may be safer to merge it only in 3.8 and expose as a new feature.

But changes to the hash of types.BuiltinMethodType may be backported. Currently 
the hash is not consistent with the equality.

--
versions: +Python 3.8 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2018-06-21 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

If [].append == [].append is True in the "unique set of callbacks" scenario, 
that implies that it's perfectly fine to not call one of them when both are 
registered. But this means that only one list ends up getting updated, when you 
tried to register both for updates. That's definitely surprising, and not in a 
good way.

--
nosy: +josh.r

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2018-06-21 Thread Armin Rigo


Change by Armin Rigo :


--
nosy:  -arigo

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2018-06-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +7458
stage: needs patch -> patch review

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2018-06-21 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

I just posted to python-dev about this issue:

https://mail.python.org/pipermail/python-dev/2018-June/153959.html

However, I think that comparing using "==" is the right thing to do. So I think 
that

>>> [].append == [].append
False

should really return True.

--
nosy: +jdemeyer

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2017-12-12 Thread Armin Rigo

Armin Rigo  added the comment:

Sorry, I think it is pointless to spend efforts to keep a relatively 
uncontroversial and small patch up-to-date, when it was not accepted in 9 
years.  Someone else would need to take it up.

--

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Armin, do you mind to create a pull request on GitHub?

--
type: enhancement -> behavior
versions: +Python 3.6, Python 3.7 -Python 3.4

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2014-03-13 Thread Armin Rigo

Changes by Armin Rigo :


--
assignee: arigo -> 

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2014-03-11 Thread Westley Martínez

Westley Martínez added the comment:

I updated the tests to be in sync, but the implementation of the fix is not so 
trivial.  The conversion from cmp() to rich comparison is the primary culprit, 
so it will take time for me to get familiar enough with the C source to update 
the fix.  I couldn't seem to get the patch to apply even to the 2.x branch (I 
think it's because it's an SVN patch...) to see if the fix actually works.

That said, this enhancement is so old that it might not warrant a fix at all.  
Maybe it should be brought up on python-dev?

--
Added file: http://bugs.python.org/file34367/1617161_test_update.diff

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2014-03-11 Thread Westley Martínez

Changes by Westley Martínez :


--
nosy: +westley.martinez

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2014-02-03 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2013-08-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you please update the patch for tip? I looks too desynchronized.

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2013-01-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2010-08-08 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions: +Python 3.2 -Python 2.7, Python 3.1

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2010-07-16 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I believe "Confirmed in trunk and py3k." means that the issue was verified to 
exist in trunk and py3k branches at the time of the message.

--

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2010-07-16 Thread Mark Lawrence

Mark Lawrence  added the comment:

msg84597 is ambiguous.  At first readng I thought it meant "the patches have 
been committed to trunk and py3k".  Second time I think it means "yes this is 
still a problem".  What is the status?

--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2009-03-30 Thread Daniel Diniz

Daniel Diniz  added the comment:

Confirmed in trunk and py3k.

--
nosy: +ajaksu2
stage:  -> patch review
type:  -> feature request
versions: +Python 2.7, Python 3.1 -Python 2.5

___
Python tracker 

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



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-13 Thread Armin Rigo

Armin Rigo <[EMAIL PROTECTED]> added the comment:

Attached patch for python trunk with tests.
It makes all three method types use the identity of their 'self'.

--
keywords: +patch
Added file: http://bugs.python.org/file9666/method_compare.diff

_
Tracker <[EMAIL PROTECTED]>

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



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-09 Thread Paul Pogonyshev

Paul Pogonyshev <[EMAIL PROTECTED]> added the comment:

Since I'm not on python-dev, I'll mention here that the new behavior
makes no sense to me at all.  Which is best highlighted by Frank in
msg63414.

--
nosy: +_doublep

_
Tracker <[EMAIL PROTECTED]>

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



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

Armin,

I think this should be discussed on python-dev.  I don't understand your 
motivation for comparing methods of distinct but equal objects as equal.  
The callback argument on the other hand, is compelling.

_
Tracker <[EMAIL PROTECTED]>

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



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-09 Thread Frank Niessink

Frank Niessink <[EMAIL PROTECTED]> added the comment:

Just to reiterate the original bug report: the issue (for me) is that
currently (python 2.5):
>>> [].__add__  == [].__add__
True
>>> [].__add__  == [1].__add__
False

Or, using a non-builtin class:
>>> class C(object):
...   def __eq__(self, other):
... return False
...   def foo(self):
...  pass
...
>>> C().foo == C().foo
False
>>> class C(object):
...   def __eq__(self, other):
... return True
...   def foo(self):
... pass
...
>>> C().foo == C().foo
True

I think it makes little sense that the equality test for the instance
methods takes the equality of the instances into account. Imho, this
behaviour is inconsistent with the principle of no surprises. The
correct behaviour (again imho of course) is that instance methods only
compare equal to the same instance method of the same instance, where 
'same instance' is based on 'is' not on '=='.  

Cheers, Frank

_
Tracker <[EMAIL PROTECTED]>

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



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-09 Thread Armin Rigo

Armin Rigo <[EMAIL PROTECTED]> added the comment:

My mistake, you are right.  I forgot about one of the many types that
CPython uses internally for built-in methods.  Indeed:

>>> [].index == [].index
False
>>> [].__add__ == [].__add__
True

I can fix this so that the answer is True in all cases; alternatively,
considering Frank Niessink's original issue, we could bring this
discussion to python-dev and decide what the correct behavior should be
and implement it consistently for all method types.

_
Tracker <[EMAIL PROTECTED]>

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



[issue1617161] Instance methods compare equal when their self's are equal

2008-03-07 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

> the change was meant to unify
> the behavior of built-in and
> user method objects

I don't think it achieved that.  Consider:

>>> [].index == [].index
False

but
>>> UserList().index == UserList().index 
True

--
nosy: +belopolsky

_
Tracker <[EMAIL PROTECTED]>

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