From 13380da91e75e1733a03a5e33af3733745575b51 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 10 Oct 2023 10:29:48 +0200 Subject: GH-104584: Fix refleak when tracing through calls (GH-110593) --- .../Core and Builtins/2023-10-10-00-49-35.gh-issue-104584.z94TuJ.rst | 1 + Objects/funcobject.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-10-10-00-49-35.gh-issue-104584.z94TuJ.rst 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 index 0000000..5164c73 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-10-10-00-49-35.gh-issue-104584.z94TuJ.rst @@ -0,0 +1 @@ +Fix a reference leak when running with :envvar:`PYTHONUOPS` or :option:`-X uops <-X>` enabled. diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 231a9c1..e8ad486 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -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; } -- cgit v0.12