From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:700:3204::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id EEzdKjk+nWXWDgAAkFu2QA (envelope-from ) for ; Tue, 09 Jan 2024 13:38:17 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id qLPHIjk+nWVUkQAAe85BDQ (envelope-from ) for ; Tue, 09 Jan 2024 13:38:17 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1704803897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=Px/DtNCvph34VkzqMGYoOfmWCAc1cp4hNeJeXk7oyMg=; b=qaFzubr2QkaVNUZP/GqXNYx0mQ02wmAm/WcziSTVCtd3y0CMgYhRL2Z/Zdc8oNmjOqmj9A PEVYV38/iREx3ANasdpvFYdAvF//vH/cUVcg1mFyOfokfd7m2/BWxYx6qhxf4vRJpDAmDQ 74sBRqkBL63f9b5NCPihhTkWVfj84HZ/GpuL9ktqPy8ib7xzq1PpW9S7mYlN8CEgwagVBQ pfkqe7xj0P7gzTRX/FHm3FJZr88IOZ/dEuk2TzqdAxA26u46dFf4Hqoky4TSPgjee31+bt xYTD9fuXymaHgiD/Lge+4cOdC57arOer1U1pvCpOZ8DH1Zz8Bj6MzTniPepVZQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1704803897; a=rsa-sha256; cv=none; b=tMJEZPJcUUXwhWWMaFh+W4UGmJtaGgwQkWnKANWrmzUoQsDz7hPLM3nMdLkp/Q4q3lp01t Fgs+jcB7mDbGYW/ADhAUQh5LzW1qZ4LJeYP7yaMYF7+wvKH5sQVhZD/z6di3JxYjpPWeTF aj3TbJ8DbW1V8UoRVgbdAFdeioXvP329m1i6wK0ClMYMgwlc9F+Ugy2XNOROgQUVu2oC3C OzWw4iItXnw4WazQtrjlCVcFMmJOpEvNzVa8vl8MS5Sqe83SyvEwWhRmY5MnMIPMyg4ko3 SVH8UdOuz+fv/9WgSrqS6IfJJe+m05rB9LfcaAZAx4HbulTnsUEFaMx+jknL/w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=none Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B3781B22F for ; Tue, 9 Jan 2024 13:38:16 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 4F4315F7C3; Tue, 9 Jan 2024 12:38:13 +0000 (UTC) Received: from phubs.tethera.net (phubs.tethera.net [IPv6:2607:5300:60:3a9d::1]) by mail.notmuchmail.org (Postfix) with ESMTPS id 10A455E50F for ; Tue, 9 Jan 2024 12:38:11 +0000 (UTC) Received: from tethera.net (fctnnbsc51w-159-2-190-140.dhcp-dynamic.fibreop.nb.bellaliant.net [159.2.190.140]) by phubs.tethera.net (Postfix) with ESMTPS id 69191180066; Tue, 9 Jan 2024 08:38:09 -0400 (AST) Received: (nullmailer pid 87582 invoked by uid 1000); Tue, 09 Jan 2024 12:38:08 -0000 From: David Bremner To: Michael J Gruber Subject: Re: BUG: Python's Message.header fails for empty headers In-Reply-To: References: <875y034e4a.fsf@tethera.net> Date: Tue, 09 Jan 2024 08:38:08 -0400 Message-ID: <8734v64r7z.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: Y26LQICK26BAOLCADBHTQ2TGSG4YBYG3 X-Message-ID-Hash: Y26LQICK26BAOLCADBHTQ2TGSG4YBYG3 X-MailFrom: david@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: =?utf-8?B?Vm9qdMSbY2ggS8OhbsSb?= , notmuch@notmuchmail.org X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE X-Migadu-Queue-Id: B3781B22F X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -0.35 X-Spam-Score: -0.35 X-TUID: X0pkXKsSCq12 Michael J Gruber writes: >> >> 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? Are you suggesting the library should change as well? > 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. > AFAICT it checks explicitely for NULL, but then throws LookupError on any falsy return from capi.ffi.string ret = capi.lib.notmuch_message_get_header(self._msg_p, name) if ret == capi.ffi.NULL: raise errors.NullPointerError() hdr = capi.ffi.string(ret) if not hdr: raise LookupError return hdr.decode(encoding='utf-8')