Here's some minimal code to illustrate the problem: import notmuch2 db = notmuch2.Database() # this works msgs = db.messages("date:today") for msg in msgs: print(msg.messageid) # this doesn't segfault, but prints truncated IDs msgs = [m for m in db.messages("date:today") if m.messageid] print(len(msgs)) for msg in msgs: print(msg.messageid) # this segfaults msgs = list(db.messages("date:today")) print(len(msgs)) for msg in msgs: print(msg.messageid) Cheers, Lars On Sun, 02 Feb 2025 13:03:53 -0700, Lars Kotthoff <lists@larsko.org> wrote: > > Sounds good. Let us know if there problems. > > Actually yes — I'm getting a list of messages with db.messages(...). This > returns the expected iterator, and I can iterate over the messages, getting IDs > etc. However, when I use list() with the result, I'm getting segmentation faults > when accessing IDs etc. It looks like list() gets only references to the > objects, but not the actual contents (and the memory associated with them is > freed when the iterator is exhausted). > > The same approach works fine with db.threads(...) (which doesn't seem to be in > the online documentation though). > > Am I missing something? Do I need to manually copy the Message objects somehow? > > Thanks, > > Lars > _______________________________________________ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-leave@notmuchmail.org