From de295e46321bc1cd3bfa3fd049d3cdda96405756 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 31 Jan 2022 10:08:47 +0100 Subject: [PATCH 1/3] python: fix a memory leak in all added __iter__ methods Reported by Yechuan Xia * python/spot/impl.i: Add %newobject to all __iter__ methods. * NEWS: Mention the list of affected methods. * THANKS: Update. --- NEWS | 8 +++++++- THANKS | 1 + python/spot/impl.i | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 3175ee43f..e7fcd8f4b 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,12 @@ New in spot 2.10.3.dev (net yet released) - Nothing yet. + Bugs fixed: + + - Fix memory leaks in Python bindings for several iteration objects. + This occured while itering on twa_graph.out(), twa_graph.edges(), + twa_graph.univ_dests(), kripke_graph.out(), kripke_graph.edges(), + mark_t.sets(), scc_info.edges_of(), scc_info.inner_edges_of(), and + on an scc_info instance. New in spot 2.10.3 (2022-01-15) diff --git a/THANKS b/THANKS index c526bf75e..193dccaf7 100644 --- a/THANKS +++ b/THANKS @@ -57,5 +57,6 @@ Victor Khomenko Vitus Lam Yann Thierry-Mieg Yannick Molinghen +Yechuan Xia Yong Li Yuri Victorovich diff --git a/python/spot/impl.i b/python/spot/impl.i index 67d29ea09..12cae6311 100644 --- a/python/spot/impl.i +++ b/python/spot/impl.i @@ -1012,6 +1012,7 @@ static void* ptr_for_bdddict(PyObject* obj) } %extend spot::internal::state_out> { + %newobject __iter__(PyObject **PYTHON_SELF); swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { return swig::make_forward_iterator(self->begin(), self->begin(), @@ -1020,6 +1021,7 @@ static void* ptr_for_bdddict(PyObject* obj) } %extend spot::internal::state_out> { + %newobject __iter__(PyObject **PYTHON_SELF); swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { return swig::make_forward_iterator(self->begin(), self->begin(), @@ -1045,6 +1047,7 @@ static void* ptr_for_bdddict(PyObject* obj) } %extend spot::internal::all_trans> { + %newobject __iter__(PyObject **PYTHON_SELF); swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { return swig::make_forward_iterator(self->begin(), self->begin(), @@ -1053,6 +1056,7 @@ static void* ptr_for_bdddict(PyObject* obj) } %extend spot::internal::all_trans> { + %newobject __iter__(PyObject **PYTHON_SELF); swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { return swig::make_forward_iterator(self->begin(), self->begin(), @@ -1061,6 +1065,7 @@ static void* ptr_for_bdddict(PyObject* obj) } %extend spot::internal::const_universal_dests { + %newobject __iter__(PyObject **PYTHON_SELF); swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { return swig::make_forward_iterator_np(self->begin(), self->begin(), @@ -1069,6 +1074,7 @@ static void* ptr_for_bdddict(PyObject* obj) } %extend spot::internal::mark_container { + %newobject __iter__(PyObject **PYTHON_SELF); swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { return swig::make_forward_iterator_np(self->begin(), self->begin(), @@ -1077,6 +1083,7 @@ static void* ptr_for_bdddict(PyObject* obj) } %extend spot::internal::scc_edges const, spot::internal::keep_all> { + %newobject __iter__(PyObject **PYTHON_SELF); swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { return swig::make_forward_iterator(self->begin(), self->begin(), @@ -1085,6 +1092,7 @@ static void* ptr_for_bdddict(PyObject* obj) } %extend spot::internal::scc_edges const, spot::internal::keep_inner_scc> { + %newobject __iter__(PyObject **PYTHON_SELF); swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { return swig::make_forward_iterator(self->begin(), self->begin(), @@ -1113,6 +1121,7 @@ static void* ptr_for_bdddict(PyObject* obj) } %extend spot::scc_info { + %newobject __iter__(PyObject **PYTHON_SELF); swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { return swig::make_forward_iterator(self->begin(), self->begin(), From bf77d0f0d3780214a1bcdbb9a6e9bb24fd6aae97 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 1 Feb 2022 13:50:56 +0100 Subject: [PATCH 2/3] Release Spot 2.10.4 * NEWS, configure.ac, doc/org/setup.org: Bump version to 2.10.4. --- NEWS | 4 ++-- configure.ac | 2 +- doc/org/setup.org | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index e7fcd8f4b..2e293872f 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ -New in spot 2.10.3.dev (net yet released) +New in spot 2.10.4 (2022-02-01) - Bugs fixed: + Bug fixed: - Fix memory leaks in Python bindings for several iteration objects. This occured while itering on twa_graph.out(), twa_graph.edges(), diff --git a/configure.ac b/configure.ac index 73823354d..67f88a914 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ # along with this program. If not, see . AC_PREREQ([2.69]) -AC_INIT([spot], [2.10.3.dev], [spot@lrde.epita.fr]) +AC_INIT([spot], [2.10.4], [spot@lrde.epita.fr]) AC_CONFIG_AUX_DIR([tools]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([1.11 gnu tar-ustar color-tests parallel-tests]) diff --git a/doc/org/setup.org b/doc/org/setup.org index 6333e2379..3b8b1b404 100644 --- a/doc/org/setup.org +++ b/doc/org/setup.org @@ -1,11 +1,11 @@ #+OPTIONS: H:2 num:nil toc:t html-postamble:nil ^:nil #+EMAIL: spot@lrde.epita.fr #+HTML_LINK_HOME: index.html -#+MACRO: SPOTVERSION 2.10.3 -#+MACRO: LASTRELEASE 2.10.3 -#+MACRO: LASTTARBALL [[http://www.lrde.epita.fr/dload/spot/spot-2.10.3.tar.gz][=spot-2.10.3.tar.gz=]] -#+MACRO: LASTNEWS [[https://gitlab.lrde.epita.fr/spot/spot/blob/spot-2-10-3/NEWS][summary of the changes]] -#+MACRO: LASTDATE 2022-01-15 +#+MACRO: SPOTVERSION 2.10.4 +#+MACRO: LASTRELEASE 2.10.4 +#+MACRO: LASTTARBALL [[http://www.lrde.epita.fr/dload/spot/spot-2.10.4.tar.gz][=spot-2.10.4.tar.gz=]] +#+MACRO: LASTNEWS [[https://gitlab.lrde.epita.fr/spot/spot/blob/spot-2-10-4/NEWS][summary of the changes]] +#+MACRO: LASTDATE 2022-02-01 #+ATTR_HTML: :id spotlogo [[file:spot2.svg]] From 664788bb16accd7572905d0f286b4c0a9a3620d3 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 1 Feb 2022 13:52:13 +0100 Subject: [PATCH 3/3] * NEWS, configure.ac: Bump version to 2.10.4.dev. --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 2e293872f..6d5fd9fc3 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +New in spot 2.10.4.dev (net yet released) + + Nothing yet. + New in spot 2.10.4 (2022-02-01) Bug fixed: diff --git a/configure.ac b/configure.ac index 67f88a914..31002ccda 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ # along with this program. If not, see . AC_PREREQ([2.69]) -AC_INIT([spot], [2.10.4], [spot@lrde.epita.fr]) +AC_INIT([spot], [2.10.4.dev], [spot@lrde.epita.fr]) AC_CONFIG_AUX_DIR([tools]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([1.11 gnu tar-ustar color-tests parallel-tests])