aboutsummaryrefslogtreecommitdiff
path: root/bindings/python-cffi/notmuch2/_message.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/_message.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/_message.py')
-rw-r--r--bindings/python-cffi/notmuch2/_message.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/bindings/python-cffi/notmuch2/_message.py b/bindings/python-cffi/notmuch2/_message.py
index d4b34e91..abe37db6 100644
--- a/bindings/python-cffi/notmuch2/_message.py
+++ b/bindings/python-cffi/notmuch2/_message.py
@@ -610,7 +610,7 @@ class PropertiesMap(base.NotmuchObject, collections.abc.MutableMapping):
def getall(self, prefix='', *, exact=False):
"""Return an iterator yielding all properties for a given key prefix.
- The returned iterator yields all peroperties which start with
+ The returned iterator yields all properties which start with
a given key prefix as ``(key, value)`` namedtuples. If called
with ``exact=True`` then only properties which exactly match
the prefix are returned, those a key longer than the prefix
@@ -655,7 +655,6 @@ class PropertiesIter(base.NotmuchIter):
def __next__(self):
if not self._fn_valid(self._iter_p):
- self._destroy()
raise StopIteration
key = capi.lib.notmuch_message_properties_key(self._iter_p)
value = capi.lib.notmuch_message_properties_value(self._iter_p)