[Python-checkins] cpython (merge 3.4 -> default): Issue #13637: Improve exception message of a2b_* functions.

berker.peksag python-checkins at python.org
Sat Feb 14 23:31:20 CET 2015


https://hg.python.org/cpython/rev/55f5e960cc40
changeset:   94623:55f5e960cc40
parent:      94621:d3ca674cf716
parent:      94622:ad4a8176a71a
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Sun Feb 15 00:31:26 2015 +0200
summary:
  Issue #13637: Improve exception message of a2b_* functions.

Patch by Vajrasky Kok.

files:
  Modules/binascii.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Modules/binascii.c b/Modules/binascii.c
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -228,13 +228,13 @@
     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;
     }

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list