From: Michael J Gruber <git@grubix.eu>
To: Austin Lund <austin.lund@gmail.com>, notmuch@notmuchmail.org
Subject: Re: Python binding SIGABRT/SIGSEGV
Date: Fri, 11 Feb 2022 10:19:45 +0100 [thread overview]
Message-ID: <164457118502.12073.16340841799786534329.git@grubix.eu> (raw)
In-Reply-To: <20220210222158.b3ym5m63he4ob3k5@sarek.home.aplund.id.au>
Austin Lund venit, vidit, dixit 2022-02-10 23:21:58:
> 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.
>
In fact you did. Sorry for overlooking this. (I still find db.messages()
vs thread.get_messages() confusing.)
The way memory handling works, one could even expect a more specific
notmuch2.ObjectDestroyedError.
As for the SIGABRT: I guess this is what "python -X faulthandler" is
for, especially in the context of C extension modules:
LANG=C python -X faulthandler t.py
Fatal Python error: Aborted
Current thread 0x00007f5bf667e740 (most recent call first):
File "/usr/lib64/python3.10/site-packages/notmuch2/_message.py", line
131 in path
File "/tmp/t.py", line 5 in <module>
Extension modules: _cffi_backend (total: 1)
Abgebrochen (Speicherabzug geschrieben)
(Yes, it disrespects LANG)
Line 131 is
ret = capi.lib.notmuch_message_get_filename(self._msg_p)
in the path method, and since _msg_p is a base.MemoryPointer() I would
have hoped (now) to get a notmuch2.ObjectDestroyedError. Maybe _msg_p is
destroyed but the Message object is not? Fishing in the dark here ...
Michael
P.S.: Sorry for the repeated message. I had problems with list bounces
in the past, then remembered the original alias wrong, then replied to
the reply to the wrong (only off-list-delivered) post. git@grubix.eu is
the one subscribed to the list. I'll remember now.
next prev parent reply other threads:[~2022-02-11 9:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 5:56 Python binding SIGABRT/SIGSEGV Austin Lund
2022-02-10 12:16 ` Michael J Gruber
2022-02-16 20:31 ` Floris Bruynooghe
[not found] ` <164449516783.6325.11211773003514272352.github@grubix.eu>
2022-02-10 22:21 ` Austin Lund
2022-02-11 9:19 ` Michael J Gruber [this message]
2022-02-11 9:41 ` Tomi Ollila
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=164457118502.12073.16340841799786534329.git@grubix.eu \
--to=git@grubix.eu \
--cc=austin.lund@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).