Skip to content

Commit b1bccab

Browse files
miss-islingtonZeroIntensitykumaraditya303
authored
[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 aed31be) Co-authored-by: Peter <[email protected]> Co-authored-by: Kumar Aditya <[email protected]>
1 parent f1acb3a commit b1bccab

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix possible memory leak in :meth:`contextvars.Context.run`.

Python/context.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ context_run(PyContext *self, PyObject *const *args,
669669
ts, args[0], args + 1, nargs - 1, kwnames);
670670

671671
if (_PyContext_Exit(ts, (PyObject *)self)) {
672+
Py_XDECREF(call_result);
672673
return NULL;
673674
}
674675

0 commit comments

Comments
 (0)