Re: Python binding SIGABRT/SIGSEGV

Subject: Re: Python binding SIGABRT/SIGSEGV

Date: Fri, 11 Feb 2022 08:21:58 +1000

To: notmuch@notmuchmail.org

Cc: Michael J Gruber

From: Austin Lund


On Thu, Feb 10, 2022 at 01:12:47PM +0100, Michael J Gruber wrote:
> Austin Lund venit, vidit, dixit 2022-02-10 06:56:12:
> > I'm clearly doing this python code wrong by not using the iterator correctly:
> > 
> > > import notmuch2
> > > 
> > > d = notmuch2.Database()
> > > m = list(d.messages("since:today"))
> > > p = m[0].path
> > > print(p)
> > 
> > But I seem to be getting a SIGABRT instead of a python stack trace.  Is
> > this the expected behaviour?
> 
> You didn't expect it :)
> 
> And this can be confusing. d.messages() returns an iterator through
> Message objects whose lifetime depends on the iterator. In contrast,
> thread.get_messages() returns on iterator through OwnedMessage objects
> whose lifetime depends on the thread.

I guess I didn't say it explicitly, but I would 'expect' the python
interpreter to raise an exception rather than having an unhandled
exception terminate the program.  Perhaps raising a MemoryError or
ReferenceError or some other exception would be better than an unhandled
SIGABRT.

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: