]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-104584: Fix refleak when tracing through calls (GH-110593)
authorBrandt Bucher <brandtbucher@microsoft.com>
Tue, 10 Oct 2023 08:29:48 +0000 (10:29 +0200)
committerGitHub <noreply@github.com>
Tue, 10 Oct 2023 08:29:48 +0000 (08:29 +0000)
Misc/NEWS.d/next/Core and Builtins/2023-10-10-00-49-35.gh-issue-104584.z94TuJ.rst [new file with mode: 0644]
Objects/funcobject.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-10-10-00-49-35.gh-issue-104584.z94TuJ.rst b/Misc/NEWS.d/next/Core and Builtins/2023-10-10-00-49-35.gh-issue-104584.z94TuJ.rst
new file mode 100644 (file)
index 0000000..5164c73
--- /dev/null
@@ -0,0 +1 @@
+Fix a reference leak when running with :envvar:`PYTHONUOPS` or :option:`-X uops <-X>` enabled.
index 231a9c141d0c0bd136534a6a1c8c9e53e2f73278..e8ad486150da479377cb4b26b41dbc18755db042 100644 (file)
@@ -288,7 +288,7 @@ _PyFunction_LookupByVersion(uint32_t version)
     PyFunctionObject *func = interp->func_state.func_version_cache[
         version % FUNC_VERSION_CACHE_SIZE];
     if (func != NULL && func->func_version == version) {
-        return (PyFunctionObject *)Py_NewRef(func);
+        return func;
     }
     return NULL;
 }