aboutsummaryrefslogtreecommitdiff
path: root/bindings/python-cffi/notmuch2/_message.py
AgeCommit message (Collapse)Author
2025-09-14bindings/python-cffi: handle NOTMUCH_STATUS_OPERATION_INVALIDATEDAnton Khirnov
Raise it as a newly added OperationInvalidatedError exception.
2025-06-16bindings/python-cffi: fix typosJakub Wilk
2025-03-13bindings/python-cffi: fix docstring for message.header()Michael J Gruber
The cffi bindings raise a LookupError in case a header is not present. Adjust the docstring to say so. The legacy bindings behaved differently, and this is one of the things to be aware of when migrating to the cffi bindings.
2025-02-28python: Fix message ID docstringFloris Bruynooghe
The messageidb attribute does not exist. The returned BinString type already allows use as both strings and binary. Presumably this was written before that type was adopted.
2025-02-22python: fix documentation typoDavid Bremner
The method is actually called 'getall'.
2025-02-07fix segfaults in Python cFFI API and add testsLars Kotthoff
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.
2022-07-05bindings/python-cffi: fix docstringDavid Bremner
the method Database.get_message does exist any more (if it ever did). This makes the docstring unhelpful as an example.
2022-01-09Merge branch 'release'David Bremner
2022-01-08python-cffi: returned OwnedMessage objects from Message.repliesDavid Bremner
If we return regular Message objects, python will try to destroy them, and the underlying notmuch object, causing e.g. the crash [1]. [1]: id:87sfu6utxg.fsf@tethera.net
2022-01-01bindings/python-cffi: add matched property to message objectsDavid Bremner
Existing users of the legacy python bindings use message.get_flags(Message.FLAG.MATCH) to determine which messages in a thread matched. Since the bindings don't provide get_flags anymore, they should provide a property analogous to the existing "excluded" property.
2020-08-09Fix typosJonas Bernoulli
2020-06-16Make messages returned by Thread objects ownedFloris Bruynooghe
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.
2020-06-16python/notmuch2: do not destroy messages owned by a queryAnton Khirnov
Any messages retrieved from a query - either directly via search_messages() or indirectly via thread objects - are owned by that query. Retrieving the same message (i.e. corresponding to the same message ID / database object) several times will always yield the same C object. The caller is allowed to destroy message objects owned by a query before the query itself - which can save memory for long-lived queries. However, that message must then never be retrieved again from that query. The python-notmuch2 bindings will currently destroy every message object in Message._destroy(), which will lead to an invalid free if the same message is then retrieved again. E.g. the following python program leads to libtalloc abort()ing: import notmuch2 db = notmuch2.Database(mode = notmuch2.Database.MODE.READ_ONLY) t = next(db.threads('*')) msgs = list(zip(t.toplevel(), t.toplevel())) msgs = list(zip(t.toplevel(), t.toplevel())) Fix this issue by creating a subclass of Message, which is used for "standalone" message which have to be freed by the caller. Message class is then used only for messages descended from a query, which do not need to be freed by the caller.
2019-12-24python/notmuch2: fix typo for "destroyed"Daniel Kahn Gillmor
Another fix to the docstrings, this time for the English part of the docstrings, not the Python class name. No functional changes here. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-12-03Rename package to notmuch2Floris Bruynooghe
This is based on a previous discussion on the list where this was more or less seen as the least-bad option.