summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-08-21 06:03:43 (GMT)
committerGeorg Brandl <georg@python.org>2007-08-21 06:03:43 (GMT)
commitd7e9f608c33264f151264eb604bbcfdafe8c7a02 (patch)
treed59e1b1eb61db9589f2b27e5fa84ab93b80834a8 /Objects
parentfdca6d8599e46ee7fc7844a798666fc60923fbe5 (diff)
downloadcpython-d7e9f608c33264f151264eb604bbcfdafe8c7a02.zip
cpython-d7e9f608c33264f151264eb604bbcfdafe8c7a02.tar.gz
cpython-d7e9f608c33264f151264eb604bbcfdafe8c7a02.tar.bz2
Revert accidental checkins from last commit.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/exceptions.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 103a662..3d79383 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -38,31 +38,18 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
/* the dict is created on the fly in PyObject_GenericSetAttr */
self->message = self->dict = NULL;
- if (!args) {
- /* MemoryError instantiation */
- args = PyTuple_New(0);
- if (!args) {
- Py_DECREF(self);
- return NULL;
- }
- } else {
- Py_INCREF(args);
- }
-
- self->args = args;
-
- /* Since the args can be overwritten in __init__, we have to store
- the original args somewhere for pickling. */
- if (PyObject_SetAttrString((PyObject *)self, "__newargs__", args) < 0) {
+ self->args = PyTuple_New(0);
+ if (!self->args) {
Py_DECREF(self);
return NULL;
}
-
+
self->message = PyString_FromString("");
if (!self->message) {
Py_DECREF(self);
return NULL;
}
+
return (PyObject *)self;
}
@@ -160,23 +147,10 @@ BaseException_repr(PyBaseExceptionObject *self)
static PyObject *
BaseException_reduce(PyBaseExceptionObject *self)
{
- PyObject *result;
- PyObject *newargs = PyObject_GetAttrString((PyObject *)self, "__newargs__");
- if (!newargs) {
- if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
- PyErr_SetString(PyExc_AttributeError,
- "To pickle exceptions via BaseException.__reduce__, "
- "you need to set the __newargs__ attribute in your "
- "custom __new__ method.");
- }
- return NULL;
- }
if (self->args && self->dict)
- result = PyTuple_Pack(3, Py_Type(self), newargs, self->dict);
+ return PyTuple_Pack(3, Py_Type(self), self->args, self->dict);
else
- result = PyTuple_Pack(2, Py_Type(self), newargs);
- Py_DECREF(newargs);
- return result;
+ return PyTuple_Pack(2, Py_Type(self), self->args);
}
/*