https://github.com/python/cpython/commit/b1bccab588b978220f16eedf839af70cb8bb76ea
commit: b1bccab588b978220f16eedf839af70cb8bb76ea
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2024-06-22T16:44:31+05:30
summary:

[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 aed31beca9a54b85a1392631a48da80602210f18)

Co-authored-by: Peter <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>

files:
A Misc/NEWS.d/next/Library/2024-06-21-14-32-56.gh-issue-120811.eBmVTV.rst
M Python/context.c

diff --git 
a/Misc/NEWS.d/next/Library/2024-06-21-14-32-56.gh-issue-120811.eBmVTV.rst 
b/Misc/NEWS.d/next/Library/2024-06-21-14-32-56.gh-issue-120811.eBmVTV.rst
new file mode 100644
index 00000000000000..62cd7b5620474a
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-06-21-14-32-56.gh-issue-120811.eBmVTV.rst
@@ -0,0 +1 @@
+Fix possible memory leak in :meth:`contextvars.Context.run`.
diff --git a/Python/context.c b/Python/context.c
index 1ffae9871be7b3..7bccfad11a45b1 100644
--- a/Python/context.c
+++ b/Python/context.c
@@ -669,6 +669,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;
     }
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to