mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
[3.12] gh-120811: Fix reference leak upon _PyContext_Exit
failure (GH-120812) (#120844)
gh-120811: Fix reference leak upon `_PyContext_Exit` failure (GH-120812)
(cherry picked from commit aed31beca9
)
Co-authored-by: Peter <zintensitydev@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
f1acb3a592
commit
b1bccab588
2 changed files with 2 additions and 0 deletions
|
@ -0,0 +1 @@
|
||||||
|
Fix possible memory leak in :meth:`contextvars.Context.run`.
|
|
@ -669,6 +669,7 @@ context_run(PyContext *self, PyObject *const *args,
|
||||||
ts, args[0], args + 1, nargs - 1, kwnames);
|
ts, args[0], args + 1, nargs - 1, kwnames);
|
||||||
|
|
||||||
if (_PyContext_Exit(ts, (PyObject *)self)) {
|
if (_PyContext_Exit(ts, (PyObject *)self)) {
|
||||||
|
Py_XDECREF(call_result);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue