mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Issue #13637: Improve exception message of a2b_* functions.
Patch by Vajrasky Kok.
This commit is contained in:
parent
50ef8a8e67
commit
3cd30c2cee
1 changed files with 2 additions and 2 deletions
|
@ -228,13 +228,13 @@ ascii_buffer_converter(PyObject *arg, Py_buffer *buf)
|
||||||
if (PyObject_GetBuffer(arg, buf, PyBUF_SIMPLE) != 0) {
|
if (PyObject_GetBuffer(arg, buf, PyBUF_SIMPLE) != 0) {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"argument should be bytes, buffer or ASCII string, "
|
"argument should be bytes, buffer or ASCII string, "
|
||||||
"not %R", Py_TYPE(arg));
|
"not '%.100s'", Py_TYPE(arg)->tp_name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!PyBuffer_IsContiguous(buf, 'C')) {
|
if (!PyBuffer_IsContiguous(buf, 'C')) {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"argument should be a contiguous buffer, "
|
"argument should be a contiguous buffer, "
|
||||||
"not %R", Py_TYPE(arg));
|
"not '%.100s'", Py_TYPE(arg)->tp_name);
|
||||||
PyBuffer_Release(buf);
|
PyBuffer_Release(buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue