unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Michael J Gruber <michaeljgruber+grubix+git@gmail.com>
To: David Bremner <david@tethera.net>
Cc: "Vojtěch Káně" <vojta001@vkane.cz>, notmuch@notmuchmail.org
Subject: Re: BUG: Python's Message.header fails for empty headers
Date: Tue, 9 Jan 2024 11:22:29 +0100	[thread overview]
Message-ID: <CAA19uiQY4xjdC2VE41d2aCwY18OHRsFyh7Qve3n-5UaXg0cQgw@mail.gmail.com> (raw)
In-Reply-To: <875y034e4a.fsf@tethera.net>

Am Di., 9. Jan. 2024 um 00:09 Uhr schrieb David Bremner <david@tethera.net>:
>
> Vojtěch Káně <vojta001@vkane.cz> writes:
>
> > At first, this sounds reasonable: the subject is empty, so it is
> > effectively missing. That would indicate a bug in Lieer itself and would
> > be fixed by a try-catch block. Notmuch's source for Message.header,
> > however, states:
> >
> >>:returns: The header value, an empty string if the header is not present.
> >>:rtype: str
> >
> > This makes an impression that no error should be raised and a harmless
> > value (at least for the above-mentioned code) should be returned. Yet
> > the docs continue with
> >
> >>:raises LookupError: if the header is not present.
> >
> > completely contradicting itself.
> >
> > And so here the questions:
> > Is my confusion justified? What is the expected nm's behavior? Can we
> > fix the docs and possible the implementation?
> >
>
> I agree the bindings documentation does not make much sense.  I suspect
> that the bindings should follow the underlying library and return "" if
> the library does.  I don't use the bindings that much, so I am curious
> what others think.

I might be misunderstanding the OP,and I didn't check the RFC, but
isn't there a difference between a missing header and an empty header?

If there is, this may come down to the difference between testing for
an empty string, None or False in dynamically typed python ...
But it does make sense for the bindings to return an empty string or
None for an empty header and LookUpError for a missing header. I have
not checked whether our bindings in fact do.

Also, note that *sending* via lieer (i.e. via GMail API) provides more
pitfalls. For example, message IDs are rewritten, which makes it
unusable for patch series.

Cheers,
Michael\r

  reply	other threads:[~2024-01-09 10:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-07 22:49 BUG: Python's Message.header fails for empty headers Vojtěch Káně
2024-01-08 23:08 ` David Bremner
2024-01-09 10:22   ` Michael J Gruber [this message]
2024-01-09 12:38     ` David Bremner
2024-01-09 12:54       ` Michael J Gruber

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=CAA19uiQY4xjdC2VE41d2aCwY18OHRsFyh7Qve3n-5UaXg0cQgw@mail.gmail.com \
    --to=michaeljgruber+grubix+git@gmail.com \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    --cc=vojta001@vkane.cz \
    /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).