Issue 8361: Remove assert in functools.total_ordering (original) (raw)

Issue8361

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.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/52608

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:59 admin set github: 52608
2010-04-10 18:54:40 ezio.melotti set status: open -> closedstage: resolved
2010-04-10 17:01:04 rhettinger set resolution: fixedmessages: +
2010-04-10 16:57:06 eric.araujo set messages: +
2010-04-10 16:44:39 rhettinger set messages: +
2010-04-10 16:29:06 rhettinger set assignee: rhettinger
2010-04-10 11:41:24 eric.araujo create