From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id yA6lJB3h514lcQAA0tVLHw (envelope-from ) for ; Mon, 15 Jun 2020 20:59:09 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4IOUIB3h515kMgAAbx9fmQ (envelope-from ) for ; Mon, 15 Jun 2020 20:59:09 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 123F894030A for ; Mon, 15 Jun 2020 20:59:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id AFAC56DE0A42; Mon, 15 Jun 2020 13:59:04 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TevRstcb54ML; Mon, 15 Jun 2020 13:59:04 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 8D89D6DE0A43; Mon, 15 Jun 2020 13:59:03 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 2CE8B6DE0A43 for ; Mon, 15 Jun 2020 13:59:02 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hzUAZfoCm2TP for ; Mon, 15 Jun 2020 13:59:01 -0700 (PDT) Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by arlo.cworth.org (Postfix) with ESMTPS id 2043D6DE0A42 for ; Mon, 15 Jun 2020 13:59:01 -0700 (PDT) Received: by mail-ej1-f51.google.com with SMTP id gl26so18919268ejb.11 for ; Mon, 15 Jun 2020 13:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=G7DSzAM51n31x8qOxB7WYR0EJgJPRYs0MoY6KqHV+Kc=; b=uQgOW5DSlvJgiz7+KROifupdTfTYRcg+11+eYPzTeotSSvQFD1G66pkUDMSc7CJnfG Mx204VkRUHHC0XZ8H2Mkd5shhdCfk4A5FrH+QJjD+N1oWl/dM1nXFvnNsxHJ4wJoGW5S zv9Njqg5jsLHxJcbls9R1AAxdiQxYs3Qlsmq3KqwLa1OKWuT4r+x7XRrIrR8DQ0O4nzH 71h6c6D7cMs6Cma26zhmqM9gtmE0i0F7j+5F3gijjdvnDBJPk0eHkwoEDU2gKvGYAH7F eQAAg6j/BEg5qhdSE7lHTvdtTXOK62rNw9PvjYKYNn5zXGZx+FetCb1TI7QTmZefVKzH sjJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version:content-transfer-encoding; bh=G7DSzAM51n31x8qOxB7WYR0EJgJPRYs0MoY6KqHV+Kc=; b=kMm4cH8AkaTrAnbbCYQsDq8UWqeu3cZLuNilzlNB3OeDOT0KkDjDp6ywi9OEjrtT+B uTDPNslYJnU8QFU3ZEpPgFjThC+zt8zQ8BdTXtZ50CH8pZGwiarfRQAFzjnWfDNcleOU jziqZgY3bF7xCdrtJ+7dkHBwKq3HqcoFs4sF91yoQkG/q/ggrEMn5Rl+m+Ap12PMvc4y oF6gc2xTodBPIpg7K8r0xdcp/xFITcsoNdZYJBqc6WZWWXPnpoFlnMTDKUKoZSouZZ8F T8i1K6LE5vFcpLMGMRTCaArA4INIlm4ehxOT7d7MDEApxUcZYvM0yJJ57dbgpAOglK4G 660g== X-Gm-Message-State: AOAM530SaVuwZb62BsOiPIgjRuoVjZy/1uuKIG2IxuhoXDDwuzaYlFCa 3V28faK1MAH0LTyvav8EYWt640fh X-Google-Smtp-Source: ABdhPJxnlexIpPPrLbdtGoONBx+g2TawXGO80/eC8tCkD254WOFQNGPduK3H/JwzKkvZRKl6XueFqw== X-Received: by 2002:a17:906:cd03:: with SMTP id oz3mr28693815ejb.391.1592254739320; Mon, 15 Jun 2020 13:58:59 -0700 (PDT) Received: from powell.devork.be (2a02-8388-8480-1180-4c18-fc69-8d8c-22b5.cable.dynamic.v6.surfer.at. [2a02:8388:8480:1180:4c18:fc69:8d8c:22b5]) by smtp.gmail.com with ESMTPSA id y21sm9707151ejp.32.2020.06.15.13.58.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2020 13:58:58 -0700 (PDT) Received: (nullmailer pid 210680 invoked by uid 1000); Mon, 15 Jun 2020 20:58:56 -0000 From: Floris Bruynooghe To: notmuch@notmuchmail.org Subject: python: Continuing message re-use fix Date: Mon, 15 Jun 2020 22:58:48 +0200 Message-Id: <20200615205850.210480-1-flub@devork.be> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=gmail.com header.s=20161025 header.b=uQgOW5DS; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: 2.49 X-TUID: /w3WGOaTc+g2 Hi, This builds on the patch by Anton Khirnov to fix the message re-use that is possible when accessing messages from a thread. I started with just addressing my own comments on this patch, but evolved it into switching the logic around and leave the normal Message object untouched. Instead I created a new OwnedMessage which is used by the Thread which does not free itself on __del__(). I think this is preferable because the other iterators, mainly Database.messages(), do not allow retrieving messages more than once since the query object is hidden from the API. I've left the original commit in this patch series to not alter any contributions. Cheers, Floris