{"id":2219623,"url":"http://patchwork.ozlabs.org/api/patches/2219623/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20260403154629.3944942-1-vfazio@gmail.com/","project":{"id":42,"url":"http://patchwork.ozlabs.org/api/projects/42/?format=json","name":"Linux GPIO development","link_name":"linux-gpio","list_id":"linux-gpio.vger.kernel.org","list_email":"linux-gpio@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260403154629.3944942-1-vfazio@gmail.com>","list_archive_url":null,"date":"2026-04-03T15:46:29","name":"[libgpiod,v2] bindings: python: allow releasing a LineRequest multiple times","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"1918e301b6b66c75eceedbfdb33e46fd5154d9d2","submitter":{"id":78694,"url":"http://patchwork.ozlabs.org/api/people/78694/?format=json","name":"Vincent Fazio","email":"vfazio@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20260403154629.3944942-1-vfazio@gmail.com/mbox/","series":[{"id":498649,"url":"http://patchwork.ozlabs.org/api/series/498649/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/list/?series=498649","date":"2026-04-03T15:46:29","name":"[libgpiod,v2] bindings: python: allow releasing a LineRequest multiple times","version":2,"mbox":"http://patchwork.ozlabs.org/series/498649/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2219623/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2219623/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-gpio+bounces-34651-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-gpio@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=f4xhQICT;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-gpio+bounces-34651-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"f4xhQICT\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.167.172","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fnNRD70NCz1yCt\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 04 Apr 2026 02:48:08 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 53471306F0DA\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  3 Apr 2026 15:46:38 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D6C353CB2F1;\n\tFri,  3 Apr 2026 15:46:34 +0000 (UTC)","from mail-oi1-f172.google.com (mail-oi1-f172.google.com\n [209.85.167.172])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CBEA3845B5\n\tfor <linux-gpio@vger.kernel.org>; Fri,  3 Apr 2026 15:46:33 +0000 (UTC)","by mail-oi1-f172.google.com with SMTP id\n 5614622812f47-47018d34159so151333b6e.2\n        for <linux-gpio@vger.kernel.org>;\n Fri, 03 Apr 2026 08:46:33 -0700 (PDT)","from vfazio4.xes-mad.com ([162.248.234.4])\n        by smtp.gmail.com with ESMTPSA id\n 586e51a60fabf-422eb25acbesm6051424fac.11.2026.04.03.08.46.31\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Fri, 03 Apr 2026 08:46:31 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775231194; cv=none;\n b=I3lY+dAtehhgyxtlD/irl2zM21ANr3FTbs+qsCh0nb3dj2R0NV0igJPIQY46P9JNDLikpgl6NFt5WPDbb/4cVfMfEskuGZIZsEG44UH3RN/DWoPzOu4St8zSJgxw/xm0iV1qd33L2X3lZIUUCBF4ElwcuhfbRdkBLrGuqZ7KaQE=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775231194; c=relaxed/simple;\n\tbh=gaIIdPfb8s4V/Vs/o3bcL4rBJ1zDnFH73IgOOe/FCSE=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=BsyBygSlZe9sw+9Kb3hX6uHezGXVB/C/BhvqNxTnR/MaBuCFnpHOYk5S1uYkrQJFy+SOtZIvHlsAF5BC3M0mT9N7fXnbSpx6vpzbsN3xSsrlqVySnHryCIa0k5HyXcyyBu7vswIT9f4OzvR4g/+kXiDQn4StbUR6oasEiIcsAA0=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=f4xhQICT; arc=none smtp.client-ip=209.85.167.172","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1775231192; x=1775835992;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=y0bQewVxRdx4hlaKqZD+ihKZhPW/xd7vF19P3sWaReg=;\n        b=f4xhQICTKVq+J9r8cvntGiH0hQF2rz4ODkxCHCl/hj+6oep1soRJFev/7+T07Ke5gx\n         TS3YJgcK4kkDb1nVPGDK9BtkkmJzwYQGUoveWYzpKyhCmuLGZo23jDs0bIPgw1Fmf3dG\n         ZJ50iM14nAh6HZ5K31oOsOGDM6pVz/UGCRE9BK2wOTORTx5WRLlVoGd9QCWmRIMEh0pS\n         UTN8QGeX0Y7DkEXjP/MAh39uCzCIskwU4WfVgh4yqIq5BhyLIMYw5L65JdOnTqQU02f5\n         s1FVs+Hgf9U3g+meaaSH7T7H8XoTPRVo3l9V3DCJUpevev8gbMHBJFHIbB5RbIq51ZYx\n         sRRg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1775231192; x=1775835992;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=y0bQewVxRdx4hlaKqZD+ihKZhPW/xd7vF19P3sWaReg=;\n        b=gCip+21XijEDP3002vqYmT1VygRPmnxKXeGcXOZyRr/hDdkoP/ok272ZmxrRG8VNw9\n         d2YDGERw2ZW8ckJTpPkxScg2i0EUSCmQANAPmGhGgiDT+U4+A65osLz+xRf+CGS8NIta\n         NsHwhGxmczMpu6Gs3yJF/WkDR0t9yKKl77pNpulq+Qbr9CBX86sBTiuYVMOvswXypN5/\n         UJfw/YIkZyJSkyhrrYv+SvQlND0aCTMiwSJ5Ck00EVDvoAfufucH3ZvmBAKTmX7imDTo\n         9XSuIlkzcexsLErkfxpdM1mQwzrKois6zQ0ULy3WW+txDWfTX46TERS8JvtICD4tFdbz\n         wWcA==","X-Gm-Message-State":"AOJu0Yyc3cKggabtRB462tnUG1UkVyqEhhbr4BPVVSPDlPMPKAS2yrly\n\t24PXbXTKATrKm71Ne8IhsbqaTpODoqEe5LLJfc//VzNBmE8co4w4w/5u9uZ3BA==","X-Gm-Gg":"ATEYQzyDLVt2vWP+3uO002kGOF7g7bOJWWpvkkyVBZ8Ha2SPbuMtZ0+kacoPERLuAwP\n\ttC/BJFyx3QCgmRZs0F9XR8+IGBK/gQF8szfM11GjY++Swf3EFGPXxECkD1+MmWj8iBTCBh0WKUC\n\t0KbmPgjoj0mhpI8EZZJe0YktrgqZ/f26SYPIp5G6HK6aFtfy+j5RJzBQb0shZH9b5DDuKzTuIW5\n\t9Yo8hT2sQi/GsN41W+uUUyagL9Lw7fpCLZEjTxi6ALnEsaOk3I+zagi0ZEFpvVH4GjaFH3AZndJ\n\tlDjUy+n30QS838F9YNqa/Ppwd+NyZhNkWY/SmvSK3rGzd0u4+CI43hBrAjUpv7Pr2HIqu3Ltvq8\n\tx77fgRa787jbi6X3uXzIPkp4EZuS+Xuk+LGZOSFHtwd4J8w7xqJOuNEBAdNFoD/nuPf8tOTRTiC\n\tJbv8cB7mI+CQIuS4okWXZD5F09THUVWfEWIEdvrdALNuWvUm23SEB/G6uRyatg7s/utSd08ZM=","X-Received":"by 2002:a05:6808:f8c:b0:467:2be8:6673 with SMTP id\n 5614622812f47-46ef211528cmr2059327b6e.0.1775231192256;\n        Fri, 03 Apr 2026 08:46:32 -0700 (PDT)","From":"Vincent Fazio <vfazio@gmail.com>","To":"linux-gpio@vger.kernel.org","Cc":"brgl@kernel.org,\n\tVincent Fazio <vfazio@gmail.com>","Subject":"[libgpiod][PATCH v2] bindings: python: allow releasing a LineRequest\n multiple times","Date":"Fri,  3 Apr 2026 10:46:29 -0500","Message-ID":"<20260403154629.3944942-1-vfazio@gmail.com>","X-Mailer":"git-send-email 2.43.0","Precedence":"bulk","X-Mailing-List":"linux-gpio@vger.kernel.org","List-Id":"<linux-gpio.vger.kernel.org>","List-Subscribe":"<mailto:linux-gpio+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-gpio+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"In Python, it is common for objects to allow their `close` method to be\nexecuted multiple times out of convenience. An example of this is the\n`IOBase` class [0] which is the base class of most file-like classes.\n\nUpdate `LineRequest.release` to follow this example as it performs the\nsame function as `close`.\n\n[0]: https://docs.python.org/release/3.10.0/library/io.html#io.IOBase.close\n\nSigned-off-by: Vincent Fazio <vfazio@gmail.com>\n---\n bindings/python/gpiod/line_request.py | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)","diff":"diff --git a/bindings/python/gpiod/line_request.py b/bindings/python/gpiod/line_request.py\nindex 0287791..a271080 100644\n--- a/bindings/python/gpiod/line_request.py\n+++ b/bindings/python/gpiod/line_request.py\n@@ -75,9 +75,9 @@ class LineRequest:\n         Release this request and free all associated resources. The object must\n         not be used after a call to this method.\n         \"\"\"\n-        self._check_released()\n-        cast(\"_ext.Request\", self._req).release()\n-        self._req = None\n+        if self._req is not None:\n+            self._req.release()\n+            self._req = None\n \n     def get_value(self, line: int | str) -> Value:\n         \"\"\"\n","prefixes":["libgpiod","v2"]}