diff --git a/Modules/cPickle.c b/Modules/cPickle.c index 9f426cc1052..6c70ad9cb49 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -3533,7 +3533,8 @@ load(Unpicklerobject *self) { break; } - if ((err = PyErr_Occurred()) == PyExc_EOFError) { + err = PyErr_Occurred(); + if (err && PyErr_ExceptionMatches(PyExc_EOFError)) { PyErr_SetNone(PyExc_EOFError); goto err; } @@ -3830,7 +3831,8 @@ noload(Unpicklerobject *self) { break; } - if ((err = PyErr_Occurred()) == PyExc_EOFError) { + err = PyErr_Occurred(); + if (err && PyErr_ExceptionMatches(PyExc_EOFError)) { PyErr_SetNone(PyExc_EOFError); goto err; }