mirror of https://github.com/python/cpython
gh-120811: Fix reference leak upon `_PyContext_Exit` failure (#120812)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
a81d434c06
commit
aed31beca9
|
@ -0,0 +1 @@
|
|||
Fix possible memory leak in :meth:`contextvars.Context.run`.
|
|
@ -661,6 +661,7 @@ context_run(PyContext *self, PyObject *const *args,
|
|||
ts, args[0], args + 1, nargs - 1, kwnames);
|
||||
|
||||
if (_PyContext_Exit(ts, (PyObject *)self)) {
|
||||
Py_XDECREF(call_result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue