From 068ceaaf588a15dcc73da71a9806d0bbda99903a Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 6 Feb 2021 01:21:52 +0100 Subject: [PATCH] event: Clear exception flag after trying asyncio exception import --- panda/src/event/asyncFuture_ext.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/panda/src/event/asyncFuture_ext.cxx b/panda/src/event/asyncFuture_ext.cxx index 5bf7cb3c94..9754142ae3 100644 --- a/panda/src/event/asyncFuture_ext.cxx +++ b/panda/src/event/asyncFuture_ext.cxx @@ -125,6 +125,9 @@ static PyObject *get_done_result(const AsyncFuture *future) { exc_type = PyObject_GetAttrString(module, "CancelledError"); Py_DECREF(module); } + else { + PyErr_Clear(); + } // If we can't get that, we should pretend and make our own. if (exc_type == nullptr) { exc_type = PyErr_NewExceptionWithDoc((char*)"concurrent.futures._base.CancelledError", @@ -218,6 +221,9 @@ result(PyObject *timeout) const { exc_type = PyObject_GetAttrString(module, "TimeoutError"); Py_DECREF(module); } + else { + PyErr_Clear(); + } // If we can't get that, we should pretend and make our own. if (exc_type == nullptr) { exc_type = PyErr_NewExceptionWithDoc((char*)"concurrent.futures._base.TimeoutError",