aboutsummaryrefslogtreecommitdiff
path: root/bindings/python-cffi/notmuch2/_base.py
diff options
context:
space:
mode:
authorLars Kotthoff <lars@larsko.org>2025-02-05 19:52:51 -0700
committerDavid Bremner <david@tethera.net>2025-02-07 12:13:16 -0400
commit9c1f6cf746725af7bbbb66e746c5d694723ac0eb (patch)
treef3c1b7b0fc87fa2970bddadb1f9efedf2102bee0 /bindings/python-cffi/notmuch2/_base.py
parent409ad6b2a897c1571044bf6e4021a35fbd85b122 (diff)
fix segfaults in Python cFFI API and add tests
Several iterators in the Python cFFI API destroyed the objects they iterated over too early (when the iterator was exhausted), causing subsequent segfaults in common cases like creating a list from the iterator. This patch fixes the segfaults and add tests to ensure that they don't happen again.
Diffstat (limited to 'bindings/python-cffi/notmuch2/_base.py')
-rw-r--r--bindings/python-cffi/notmuch2/_base.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/bindings/python-cffi/notmuch2/_base.py b/bindings/python-cffi/notmuch2/_base.py
index 1cf03c88..c83abd01 100644
--- a/bindings/python-cffi/notmuch2/_base.py
+++ b/bindings/python-cffi/notmuch2/_base.py
@@ -167,7 +167,7 @@ class NotmuchIter(NotmuchObject, collections.abc.Iterator):
It is tempting to use a generator function instead, but this would
not correctly respect the :class:`NotmuchObject` memory handling
protocol and in some unsuspecting cornercases cause memory
- trouble. You probably want to sublcass this in order to wrap the
+ trouble. You probably want to subclass this in order to wrap the
value returned by :meth:`__next__`.
:param parent: The parent object.
@@ -223,7 +223,6 @@ class NotmuchIter(NotmuchObject, collections.abc.Iterator):
def __next__(self):
if not self._fn_valid(self._iter_p):
- self._destroy()
raise StopIteration()
obj_p = self._fn_get(self._iter_p)
self._fn_next(self._iter_p)