New submission from STINNER Victor <victor.stin...@haypocalc.com>:

b'abc'.partition(':') raises a confusing TypeError('expected an object with the 
buffer interface'): what is a buffer? what is the buffer interface?

The error comes from PyObject_AsCharBuffer() which is used by:
 - bytes methods: partition, rpartition, find, index, rfind, rindex, count, 
translate, replace, startswith, endswith
 - complex(): raise a better but incomplete error message on error ("complex() 
arg is not a string"), incomplete because number is not mentionned
 - float(): raise a better error message on error ("float() argument must be a 
string or a number")
 - PyArg_Parse*() with the "e" format -> posix.spawnvpe(), imp.load_compiled(), 
imp.load_source(), imp.load_package()

The error message should be changed to something mentioning classic Python 
terms. Eg. TypeError("expected bytes, bytearray or buffer compatible object").

----------
components: Interpreter Core
messages: 123263
nosy: haypo
priority: normal
severity: normal
status: open
title: Change PyObject_AsCharBuffer() error message
versions: Python 3.1, Python 3.2

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

Reply via email to