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.

classification
Title: Remove assert in functools.total_ordering
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: eric.araujo, rhettinger
Priority: normal Keywords: patch

Created on 2010-04-10 11:41 by eric.araujo, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
remove-assert-in-total_ordering.diff eric.araujo, 2010-04-10 11:41
Messages (4)
msg102770 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-04-10 11:41
Hello

The correct behavior of functools.total_ordering depends on a check performed with an assert. Attached patch changes it to a test that always runs.

Since it’s a kind of protocol error, I went for TypeError but you may disagree.

Regards
msg102787 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-04-10 16:44
The max(roots) line that follows will raise its own ValueError when given an empty input.   Will mull over your patch.  I may just delete the assert line, leave it as-is, or apply something like your patch (but with a ValueError).
msg102788 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-04-10 16:57
Ok. It won’t have a user-friendly error message, though.

You may be interested in a minor doc patch in #5341.

Regards
msg102789 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-04-10 17:01
r79930 and r79931
History
Date User Action Args
2022-04-11 14:56:59adminsetgithub: 52608
2010-04-10 18:54:40ezio.melottisetstatus: open -> closed
stage: resolved
2010-04-10 17:01:04rhettingersetresolution: fixed
messages: + msg102789
2010-04-10 16:57:06eric.araujosetmessages: + msg102788
2010-04-10 16:44:39rhettingersetmessages: + msg102787
2010-04-10 16:29:06rhettingersetassignee: rhettinger
2010-04-10 11:41:24eric.araujocreate