[Python-checkins] r46550 - python/trunk/Objects/exceptions.c
georg.brandl
python-checkins at python.org
Tue May 30 09:04:56 CEST 2006
Author: georg.brandl
Date: Tue May 30 09:04:55 2006
New Revision: 46550
Modified:
python/trunk/Objects/exceptions.c
Log:
Restore exception pickle support. #1497319.
Modified: python/trunk/Objects/exceptions.c
==============================================================================
--- python/trunk/Objects/exceptions.c (original)
+++ python/trunk/Objects/exceptions.c Tue May 30 09:04:55 2006
@@ -141,7 +141,17 @@
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;
+ }
}
More information about the Python-checkins
mailing list