From b65ff8f51b710a8496f3b2d7fc1fcbe7bc68ac53 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
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<types::numpy_gexpr<Arg, S...>>::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

