New submission from Dan Snider <mr.assume.a...@gmail.com>:
internal_bisect_left and internal_bisect_right use PySequence_Size when a "hi" argument wasn't provided, which causes this silly error message: >>> bisect.bisect_right(dict.fromkeys(range(10)), 5) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: object of type 'dict' has no len() They could use PyObject_Size and let PySequence_GetItem in the loop catch the error: >>> bisect.bisect_right(dict.fromkeys(range(10)), 5, 0, 10) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'dict' object does not support indexing Since that actually makes sense and is more efficient / less verbose than adding a PySequence_Check. ---------- components: Interpreter Core messages: 326672 nosy: bup priority: normal severity: normal status: open title: Incorrect error messages in bisect versions: Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34842> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com