diff options
author | Guido van Rossum <guido@python.org> | 2007-05-22 21:56:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-22 21:56:47 (GMT) |
commit | 4581ae5fa2450db3f00384e4b2e86654605100d4 (patch) | |
tree | 3029bdbbfd3495e4d832036cc17d7ab0bc2f1c02 /Modules/binascii.c | |
parent | 0e225aa09bb8059c333424d58beecd833b2d2b6c (diff) | |
download | cpython-4581ae5fa2450db3f00384e4b2e86654605100d4.zip cpython-4581ae5fa2450db3f00384e4b2e86654605100d4.tar.gz cpython-4581ae5fa2450db3f00384e4b2e86654605100d4.tar.bz2 |
Make test_base64 pass.
Change binascii.Error to derive from ValueError
and raise binascii.Error everywhere where values are bad
(why on earth did the old code use TypeError?!?).
Diffstat (limited to 'Modules/binascii.c')
-rw-r--r-- | Modules/binascii.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/binascii.c b/Modules/binascii.c index 8db73e7..04a945e 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -1000,7 +1000,7 @@ binascii_unhexlify(PyObject *self, PyObject *args) * raise an exception. */ if (arglen % 2) { - PyErr_SetString(PyExc_TypeError, "Odd-length string"); + PyErr_SetString(Error, "Odd-length string"); return NULL; } @@ -1013,7 +1013,7 @@ binascii_unhexlify(PyObject *self, PyObject *args) int top = to_int(Py_CHARMASK(argbuf[i])); int bot = to_int(Py_CHARMASK(argbuf[i+1])); if (top == -1 || bot == -1) { - PyErr_SetString(PyExc_TypeError, + PyErr_SetString(Error, "Non-hexadecimal digit found"); goto finally; } @@ -1371,7 +1371,7 @@ initbinascii(void) PyDict_SetItemString(d, "__doc__", x); Py_XDECREF(x); - Error = PyErr_NewException("binascii.Error", NULL, NULL); + Error = PyErr_NewException("binascii.Error", PyExc_ValueError, NULL); PyDict_SetItemString(d, "Error", Error); Incomplete = PyErr_NewException("binascii.Incomplete", NULL, NULL); PyDict_SetItemString(d, "Incomplete", Incomplete); |