]> granicus.if.org Git - python/commitdiff
binascii_unhexlify(): Better error message, courtesy effbot.
authorBarry Warsaw <barry@python.org>
Tue, 15 Aug 2000 06:59:58 +0000 (06:59 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 15 Aug 2000 06:59:58 +0000 (06:59 +0000)
Modules/binascii.c

index 89ccc79c6eb040ff68bd1c0eea6d6934989194a1..1fe0663574e62fd6c056bf1e4392f4af9fb295d4 100644 (file)
@@ -944,12 +944,12 @@ binascii_unhexlify(PyObject *self, PyObject *args)
        if (!PyArg_ParseTuple(args, "s#:a2b_hex", &argbuf, &arglen))
                return NULL;
 
-       /* XXX What should we do about odd-lengthed strings?  Should we add
-        * an implicit leading zero, or a trailing zero?  For now, raise an
-        * exception.
+       /* XXX What should we do about strings with an odd length?  Should
+        * we add an implicit leading zero, or a trailing zero?  For now,
+        * raise an exception.
         */
        if (arglen % 2) {
-               PyErr_SetString(PyExc_TypeError, "odd lengthed string");
+               PyErr_SetString(PyExc_TypeError, "Odd-length string");
                return NULL;
        }
 
@@ -965,7 +965,7 @@ binascii_unhexlify(PyObject *self, PyObject *args)
                int bot = to_int(Py_CHARMASK(argbuf[i+1]));
                if (top == -1 || bot == -1) {
                        PyErr_SetString(PyExc_TypeError,
-                                       "non-hexadecimal digit found");
+                                       "Non-hexadecimal digit found");
                        goto finally;
                }
                retbuf[j++] = (top << 4) + bot;