diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-08-16 09:52:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-16 09:52:10 (GMT) |
commit | af3e491d2bb02988d9f8d24ac2ba6f0b22b2130a (patch) | |
tree | 70b4a085fbb34cc3ccf52c688640a98de94450ba /Modules | |
parent | d55a775ac2fe32f3ed7e4b25f76d9f4d77745a1d (diff) | |
download | cpython-af3e491d2bb02988d9f8d24ac2ba6f0b22b2130a.zip cpython-af3e491d2bb02988d9f8d24ac2ba6f0b22b2130a.tar.gz cpython-af3e491d2bb02988d9f8d24ac2ba6f0b22b2130a.tar.bz2 |
gh-95808: Add missing early returns in _asynciomodule.c (GH-95809)
(cherry picked from commit b2afe482f21b826d53886a69ea2c99d0d940c59a)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_asynciomodule.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index cb7afec..10679be 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -631,8 +631,6 @@ create_cancelled_error(FutureObj *fut) } else { exc = PyObject_CallOneArg(asyncio_CancelledError, msg); } - PyException_SetContext(exc, fut->fut_cancelled_exc); - Py_CLEAR(fut->fut_cancelled_exc); return exc; } @@ -640,6 +638,9 @@ static void future_set_cancelled_error(FutureObj *fut) { PyObject *exc = create_cancelled_error(fut); + if (exc == NULL) { + return; + } PyErr_SetObject(asyncio_CancelledError, exc); Py_DECREF(exc); } |