summaryrefslogtreecommitdiffstats
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r--Modules/_pickle.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 0f5b06b..52fa156 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -3834,8 +3834,11 @@ load_build(UnpicklerObject *self)
inst = self->stack->data[self->stack->length - 1];
setstate = PyObject_GetAttrString(inst, "__setstate__");
- if (setstate == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) {
- PyErr_Clear();
+ if (setstate == NULL) {
+ if (PyErr_ExceptionMatches(PyExc_AttributeError))
+ PyErr_Clear();
+ else
+ return -1;
}
else {
PyObject *result;