Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

This probably doesn't warrant another tracker entry.  Serhiy already had a PR 
for this and attached it to the original bug report for 
https://bugs.python.org/issue32500 .  See 
https://github.com/python/cpython/pull/7846

My suggestion would be to just change the error message in PySequence_Size() 
from "object of type '%.200s' has no len()" to "object of type '%.200s' has no 
len() or does not support the sequence protocol (consider using a list 
instead)".

Marking this as low priority because the behavior has existed for a very long 
time and hasn't bothered anyone until now (possibly because the bisect module 
is documented to only search lists).  Also, this is a specific instance of a 
more general, pervasive, and hard problem where low level routines raise 
exceptions that have error messages than may not make much sense from the point 
of view someone calling higher level APIs.

Suggest closing this as a duplicate and continuing the discussion back in 
issue32500 where it arose.  This would show-up in any C code that calls 
PySequence_Size() not just bisect.

----------
nosy: +rhettinger
priority: normal -> low

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

Reply via email to