Re: BUG: Python's Message.header fails for empty headers

Subject: Re: BUG: Python's Message.header fails for empty headers

Date: Mon, 08 Jan 2024 19:08:53 -0400

To: Vojtěch Káně, notmuch@notmuchmail.org

Cc:

From: David Bremner


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.
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: