This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients koobs, serhiy.storchaka, vstinner
Date 2017-11-09.11:44:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510227857.45.0.213398074469.issue31893@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-11-09 11:44:17serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner, koobs
2017-11-09 11:44:17serhiy.storchakasetmessageid: <1510227857.45.0.213398074469.issue31893@psf.upfronthosting.co.za>
2017-11-09 11:44:17serhiy.storchakalinkissue31893 messages
2017-11-09 11:44:17serhiy.storchakacreate