aboutsummaryrefslogtreecommitdiff
path: root/bindings/python-cffi/notmuch2/_thread.py
diff options
context:
space:
mode:
authorFloris Bruynooghe <flub@devork.be>2020-06-15 22:58:50 +0200
committerDavid Bremner <david@tethera.net>2020-06-16 08:02:02 -0300
commit2d895a0119b423b117d10e890c9e0eb5d2a9cdf8 (patch)
tree53cac8051fb2e09b9be94972365ad6d3af956c6b /bindings/python-cffi/notmuch2/_thread.py
parent131757907907380213b32934d9e73cec942ace43 (diff)
Make messages returned by Thread objects owned
This reverses the logic of StandaloneMessage to instead create a OwnedMessage. Only the Thread class allows retrieving messages more then once so it can explicitly create such messages. The added test fails with SIGABRT without the fix for the message re-use in threads being present.
Diffstat (limited to 'bindings/python-cffi/notmuch2/_thread.py')
-rw-r--r--bindings/python-cffi/notmuch2/_thread.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bindings/python-cffi/notmuch2/_thread.py b/bindings/python-cffi/notmuch2/_thread.py
index bb76f2dc..e883f308 100644
--- a/bindings/python-cffi/notmuch2/_thread.py
+++ b/bindings/python-cffi/notmuch2/_thread.py
@@ -62,7 +62,9 @@ class Thread(base.NotmuchObject, collections.abc.Iterable):
:raises ObjectDestroyedError: if used after destroyed.
"""
msgs_p = capi.lib.notmuch_thread_get_toplevel_messages(self._thread_p)
- return message.MessageIter(self, msgs_p, db=self._db)
+ return message.MessageIter(self, msgs_p,
+ db=self._db,
+ msg_cls=message.OwnedMessage)
def __iter__(self):
"""Return an iterator over all the messages in the thread.
@@ -72,7 +74,9 @@ class Thread(base.NotmuchObject, collections.abc.Iterable):
:raises ObjectDestroyedError: if used after destroyed.
"""
msgs_p = capi.lib.notmuch_thread_get_messages(self._thread_p)
- return message.MessageIter(self, msgs_p, db=self._db)
+ return message.MessageIter(self, msgs_p,
+ db=self._db,
+ msg_cls=message.OwnedMessage)
@property
def matched(self):