From 8a1a5945908c7a0b2b487a98431ff46ab934014a Mon Sep 17 00:00:00 2001 From: Jim Fulton Date: Sun, 8 Feb 2004 04:21:26 +0000 Subject: [PATCH] Fixed a bug in object.__reduce_ex__ (reduce_2) when using protocol 2. Failure to clear the error when attempts to get the __getstate__ attribute fail caused intermittent errors and odd behavior. --- Misc/NEWS | 4 ++++ Objects/typeobject.c | 1 + 2 files changed, 5 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index 939ce662518..33ff1527ddb 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -136,6 +136,10 @@ Core and builtins same as split() except that it scans the string from the end working towards the beginning. See SF feature request 801847. +- Fixed a bug in object.__reduce_ex__ when using protocol 2. Failure + to clear the error when attempts to get the __getstate__ attribute + fail caused intermittent errors and odd behavior. + Extension modules ----------------- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 6403103b834..f26ddd6bd3b 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2581,6 +2581,7 @@ reduce_2(PyObject *obj) goto end; } else { + PyErr_Clear(); state = PyObject_GetAttrString(obj, "__dict__"); if (state == NULL) { PyErr_Clear();