diff options
author | Barry Warsaw <barry@python.org> | 2000-08-15 06:59:58 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2000-08-15 06:59:58 (GMT) |
commit | 16168477ebed81305c7b23f9c61fd558ba6e9f81 (patch) | |
tree | 7d21fbcbc9a30a5605e919436bfa636d70391a8f /Modules/binascii.c | |
parent | 97ca66fd57668b40d61309d2e044a17311c265ac (diff) | |
download | cpython-16168477ebed81305c7b23f9c61fd558ba6e9f81.zip cpython-16168477ebed81305c7b23f9c61fd558ba6e9f81.tar.gz cpython-16168477ebed81305c7b23f9c61fd558ba6e9f81.tar.bz2 |
binascii_unhexlify(): Better error message, courtesy effbot.
Diffstat (limited to 'Modules/binascii.c')
-rw-r--r-- | Modules/binascii.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/binascii.c b/Modules/binascii.c index 89ccc79..1fe0663 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -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; |