diff options
author | Georg Brandl <georg@python.org> | 2006-05-30 07:04:55 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-05-30 07:04:55 (GMT) |
commit | ddba473e2639f4db6db51e66851a5c056ba0e18d (patch) | |
tree | 7e1f92a54e60e8b636445f2e37dd733903ce221f /Objects | |
parent | 33f4a6a31a940da72db685ec575bee047be77e9a (diff) | |
download | cpython-ddba473e2639f4db6db51e66851a5c056ba0e18d.zip cpython-ddba473e2639f4db6db51e66851a5c056ba0e18d.tar.gz cpython-ddba473e2639f4db6db51e66851a5c056ba0e18d.tar.bz2 |
Restore exception pickle support. #1497319.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/exceptions.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 44c8fd6..986d211 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -141,7 +141,17 @@ BaseException_repr(PyBaseExceptionObject *self) static PyObject * BaseException_reduce(PyBaseExceptionObject *self) { - return PyTuple_Pack(3, self->ob_type, self->args, self->dict); + if (self->args && self->dict) + return PyTuple_Pack(3, self->ob_type, self->args, self->dict); + else if (self->args) + return PyTuple_Pack(2, self->ob_type, self->args); + else { + PyObject *res, *tup = PyTuple_New(0); + if (!tup) return NULL; + res = PyTuple_Pack(2, self->ob_type, tup); + Py_DECREF(tup); + return res; + } } |