From dfb6c2e4744e18c19a6bcfc76d762bbc1ca1a0ca Mon Sep 17 00:00:00 2001 From: dongjiao_joan Date: Tue, 21 May 2024 04:24:34 +0800 Subject: [PATCH] Fix memory leak on slices when converting a gexpr back to python --- ...en-converting-a-gexpr-back-to-python.patch | 25 +++++++++++++++++++ python-pythran.spec | 8 ++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 backport-fix-leak-on-slices-when-converting-a-gexpr-back-to-python.patch diff --git a/backport-fix-leak-on-slices-when-converting-a-gexpr-back-to-python.patch b/backport-fix-leak-on-slices-when-converting-a-gexpr-back-to-python.patch new file mode 100644 index 0000000..46f988b --- /dev/null +++ b/backport-fix-leak-on-slices-when-converting-a-gexpr-back-to-python.patch @@ -0,0 +1,25 @@ +From b65ff8f51b710a8496f3b2d7fc1fcbe7bc68ac53 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Tue, 23 Apr 2024 23:26:02 +0200 +Subject: [PATCH] FIx leak on slices when converting a gexpr back to python + +Fix https://github.com/serge-sans-paille/pythran/issues/2200 +--- + pythran/pythonic/types/ndarray.hpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/pythran/pythonic/types/ndarray.hpp b/pythran/pythonic/types/ndarray.hpp +index d0aa75925..191933ccd 100644 +--- a/pythran/pythonic/types/ndarray.hpp ++++ b/pythran/pythonic/types/ndarray.hpp +@@ -1531,6 +1531,7 @@ PyObject *to_python>::convert( + : ::to_python(v.slices); + PyObject *base = ::to_python(v.arg); + PyObject *res = PyObject_GetItem(base, slices); ++ Py_DECREF(slices); + Py_DECREF(base); + if (transpose) { + PyObject *Transposed = +-- +2.43.0 + diff --git a/python-pythran.spec b/python-pythran.spec index 7612138..f3b3044 100644 --- a/python-pythran.spec +++ b/python-pythran.spec @@ -1,11 +1,12 @@ %global _empty_manifest_terminate_build 0 Name: python-pythran Version: 0.14.0 -Release: 1 +Release: 2 Summary: An ahead of time compiler for a subset of the Python language. License: BSD-3-Clause URL: https://github.com/serge-sans-paille/pythran Source0: https://files.pythonhosted.org/packages/2c/ab/a647b8cc3ac1aa07cde06875157696e4522958fb8363474bce21c302d4d8/pythran-0.14.0.tar.gz +Patch0: backport-fix-leak-on-slices-when-converting-a-gexpr-back-to-python.patch BuildArch: noarch %description An ahead of time compiler for a subset of the Python language, with a focus on scientific computing. @@ -30,7 +31,7 @@ Provides: python3-pythran-doc Development documents and examples for pythran. %prep -%autosetup -n pythran-%{version} +%autosetup -p1 -n pythran-%{version} sed -i 's/\~=/\>=/g' requirements.txt %build @@ -73,5 +74,8 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Tue May 21 2024 dongjiao - 0.14.0-2 +- Fix memory leak on slices when converting a gexpr back to python + * Thu Nov 30 2023 Dongxing Wang - 0.14.0-1 - Init package