diff options
author | Brett Cannon <bcannon@gmail.com> | 2006-09-09 07:11:46 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2006-09-09 07:11:46 (GMT) |
commit | ca2ca79d23645eb2ee457f64506d05f232c673c9 (patch) | |
tree | 674299e348769d9b15b109e1434b1398d048fd8b /Objects/exceptions.c | |
parent | af57f6065f2131dad699667c11fdc9520a84986b (diff) | |
download | cpython-ca2ca79d23645eb2ee457f64506d05f232c673c9.zip cpython-ca2ca79d23645eb2ee457f64506d05f232c673c9.tar.gz cpython-ca2ca79d23645eb2ee457f64506d05f232c673c9.tar.bz2 |
Remove the __unicode__ method from exceptions. Allows unicode() to be called
on exception classes. Would require introducing a tp_unicode slot to make it
work otherwise.
Fixes bug #1551432 and will be backported.
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r-- | Objects/exceptions.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c index cdf2609..fda2ab1 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -175,27 +175,10 @@ BaseException_setstate(PyObject *self, PyObject *state) Py_RETURN_NONE; } -#ifdef Py_USING_UNICODE -/* while this method generates fairly uninspired output, it a least - * guarantees that we can display exceptions that have unicode attributes - */ -static PyObject * -BaseException_unicode(PyBaseExceptionObject *self) -{ - if (PyTuple_GET_SIZE(self->args) == 0) - return PyUnicode_FromUnicode(NULL, 0); - if (PyTuple_GET_SIZE(self->args) == 1) - return PyObject_Unicode(PyTuple_GET_ITEM(self->args, 0)); - return PyObject_Unicode(self->args); -} -#endif /* Py_USING_UNICODE */ static PyMethodDef BaseException_methods[] = { {"__reduce__", (PyCFunction)BaseException_reduce, METH_NOARGS }, {"__setstate__", (PyCFunction)BaseException_setstate, METH_O }, -#ifdef Py_USING_UNICODE - {"__unicode__", (PyCFunction)BaseException_unicode, METH_NOARGS }, -#endif {NULL, NULL, 0, NULL}, }; |