Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

Oh, I didn't test on 2.7.

The old code contradicted the common comparison behavior. It allowed comparing 
select.kevent with other objects only for equality as for identity. `kevent == 
other` always returned False even if `other == kevent` returned True. `kevent < 
other` raised a TypeError.

The new code uses the default behavior. `kevent == other` returns the same as 
`other == kevent` (False by default if types are not comparable, but may return 
True if `other.__eq__(kevent)` returns True). `kevent < other` returns the same 
as `other > kevent`. E.g. raises a TypeError by default in Python 3. But in 
Python 2 all objects are comparable by default, and this breaks a test which 
expects that select.kevent is not comparable.

There are two ways to fix this:

1. Make select.kevent non-comparable again. This contradicts the default 
behavior and I don't know reasons why it should be non-comparable, but this was 
an existing behavior.

2. Remove the tests or change them to test that comparing select.kevent with 
other object doesn't raise an error.

----------

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

Reply via email to