]> granicus.if.org Git - python/commitdiff
Issue #13637: Improve exception message of a2b_* functions.
authorBerker Peksag <berker.peksag@gmail.com>
Sat, 14 Feb 2015 22:31:00 +0000 (00:31 +0200)
committerBerker Peksag <berker.peksag@gmail.com>
Sat, 14 Feb 2015 22:31:00 +0000 (00:31 +0200)
Patch by Vajrasky Kok.

Modules/binascii.c

index 86b63bb4f54de029951ab147630389b19dae1d09..4e6953b8baa9bb044d2f239ab2272631d4f363e4 100644 (file)
@@ -228,13 +228,13 @@ ascii_buffer_converter(PyObject *arg, Py_buffer *buf)
     if (PyObject_GetBuffer(arg, buf, PyBUF_SIMPLE) != 0) {
         PyErr_Format(PyExc_TypeError,
                      "argument should be bytes, buffer or ASCII string, "
-                     "not %R", Py_TYPE(arg));
+                     "not '%.100s'", Py_TYPE(arg)->tp_name);
         return 0;
     }
     if (!PyBuffer_IsContiguous(buf, 'C')) {
         PyErr_Format(PyExc_TypeError,
                      "argument should be a contiguous buffer, "
-                     "not %R", Py_TYPE(arg));
+                     "not '%.100s'", Py_TYPE(arg)->tp_name);
         PyBuffer_Release(buf);
         return 0;
     }