Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2219622/?format=api
{ "id": 2219622, "url": "http://patchwork.ozlabs.org/api/patches/2219622/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260403154604.3944747-1-vfazio@gmail.com/", "project": { "id": 42, "url": "http://patchwork.ozlabs.org/api/projects/42/?format=api", "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": "<20260403154604.3944747-1-vfazio@gmail.com>", "list_archive_url": null, "date": "2026-04-03T15:46:04", "name": "[libgpiod,v2] bindings: python: allow closing a Chip multiple times", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "18834608c3329672620cdb33a047bafe319b56f8", "submitter": { "id": 78694, "url": "http://patchwork.ozlabs.org/api/people/78694/?format=api", "name": "Vincent Fazio", "email": "vfazio@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260403154604.3944747-1-vfazio@gmail.com/mbox/", "series": [ { "id": 498648, "url": "http://patchwork.ozlabs.org/api/series/498648/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=498648", "date": "2026-04-03T15:46:04", "name": "[libgpiod,v2] bindings: python: allow closing a Chip multiple times", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/498648/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2219622/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219622/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-gpio+bounces-34650-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=PnK7jxGC;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-gpio+bounces-34650-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=\"PnK7jxGC\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.210.51", "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 sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::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 4fnNPN1dCzz1yCt\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 04 Apr 2026 02:46:32 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 4DAD8300832D\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 3 Apr 2026 15:46:29 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 3C5713CB2F6;\n\tFri, 3 Apr 2026 15:46:28 +0000 (UTC)", "from mail-ot1-f51.google.com (mail-ot1-f51.google.com\n [209.85.210.51])\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 C919C220F3E\n\tfor <linux-gpio@vger.kernel.org>; Fri, 3 Apr 2026 15:46:26 +0000 (UTC)", "by mail-ot1-f51.google.com with SMTP id\n 46e09a7af769-7d1872504cbso1926247a34.0\n for <linux-gpio@vger.kernel.org>;\n Fri, 03 Apr 2026 08:46:26 -0700 (PDT)", "from vfazio4.xes-mad.com ([162.248.234.4])\n by smtp.gmail.com with ESMTPSA id\n 46e09a7af769-7dba7126322sm4654515a34.3.2026.04.03.08.46.24\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 03 Apr 2026 08:46:25 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775231188; cv=none;\n b=Af0mWAFIZzWuKGIlj6ujCWJe5RjTSMmsLZ5OWSmeltZKLcY+eSjROEdBIN+TaDZrpIvsOYIdoPwqlCW54Mmcn3ZZCv2w23OJCYSHK//yi6J52UAGfNxari4MoResxJ85csXFQcIDONnA8vFxscTZiC7Vex7XDM/RD//yLxupshw=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775231188; c=relaxed/simple;\n\tbh=w1Jcj4evadKnHw2+V9YEcsZdhjluYVxC9YWfJQUWgqQ=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=ETgsAPM2e9j362VO8bJfVVf2fvbS3mwV/65+ZVj2hAxkrmEHaq+ZDIXuDm349zxxLPTItsp/iHNq+Wo/vMG42MX9soOAOf1zu1fR2Qdn0ER6/qV6IM9CCxd6FqJXKn4M1tvwwm+LUec4HTgg4rvN8/ojVQff5i8NsUlUSprjyz8=", "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=PnK7jxGC; arc=none smtp.client-ip=209.85.210.51", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775231185; x=1775835985;\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=ftAo6h2+Fiym93CxolOgRY8fqwJc6rkVQ6wYUBb4LDg=;\n b=PnK7jxGCbw+G+cJZUb+kXOUFWh1svI1iXrI9w8k7TBVJrJidLBqUSedIBJvL9vev+h\n hC40OP/BB5Q0dLeoH9EJFyw5tdt7cW4qjmPVX8MkjMkUTp1/kPgB3/8GtOmZYEqZNdw7\n PyyBopeRbQNEf/X1wgnYGXpxdF+1hqPKOpAttyOVNtBYNSCu9j7UjO+vqhk4Xi2MGT+K\n OVn5YUJeh8rxWlFSW+xOiAL9gknw+sxOuUZHjyEz4FaBZ9NNHy92FipgGEBTVlqQeNO4\n MU5HM9mC2GY29TCPbXxLihs/hAtNcdWMOkPmgS4jlEIRySkh9/+OfTnbel4UMH7U5dEs\n xLZQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775231185; x=1775835985;\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=ftAo6h2+Fiym93CxolOgRY8fqwJc6rkVQ6wYUBb4LDg=;\n b=ALerH8mz9EF2LGmiKKvyQuetg+STtBFkzsGpXu0vv7fkiuytqiaEcEqmsmVnCnoTzB\n vq+8k1h96N71IA2pKp6rxe9/Cg2rbFmMO5ju1DVu9R66UTm6zmXG0vhKjCOXomcO5gWx\n muvWG6WLrDiTObY+BKW1JSoO+4PoaKqu/N9i+aCZY7lVr7l9kOzjkSITw4VbEBPKEh+B\n zQaKlBzmyUmB87PgVyE502S/n9jrlaqWAKaPflFVOBFU0gJRR8CG7s48T2C/EdWaZmBf\n reF9Pvjs2xVUj/htC1Rpm7utoiJityTlPU9MTf4eYPtup+p+1n795+M5sOh0/020r1fb\n sQXw==", "X-Gm-Message-State": "AOJu0YwAeWoRCZQ9NIx2Gj8Wbd3SQjUJBaAb1hZr7exbHwMEzArt9F62\n\t57Loi3fFhMXBvHUV5cnVu78DHE4WYvO7AGooq6BVNYekaAaWVykGVUF52fpdhg==", "X-Gm-Gg": "ATEYQzzqDYHhvM+nHH1FN1vqsig+Y126SVR0sn+Bopd+BZzD4U7V+S5Ba63TIaPnC+R\n\tuREchP36Czuvw0qkoDj2/HyFE6HMn+GADBuIw2XwwTUYRJMi1Jg/DVZ/2KLem8PlUBTrNZfhxdw\n\tuMACJgLDnYHTND+dP3flFfGxkVOSTv0+i3fE9JeKry93LPDH+U+Cc7BJsebsR4N1bSNR/dvkC7I\n\tTAgZgfhkqiSK1/nEy1hRFeTx89wCLb6cPmNSXQ+1G97ZOYi9AmHo/WqcD7bBsO5GBRDhhbpmsLW\n\tZiOau6gELtpk2SXwTLvilY2+w/EKvP5XgudV4OIE1xxX+Z/Ce8DlKTaa7si0ANOpj+EQCIg0f6Q\n\tadaoTH3ndOQ92HlAz7YHu4RfVUlf7cQgUVtOdeSZuUqi7MwJd5nBoSeYNYhk1H+2WLun6M8BO2c\n\tS7aBFrzTKQE/nUjaKVyCU2RY8mc24yDIv9LzQT9F+fAOLjK+e3+wKN8WQnXiBI54HFy4dgSV0=", "X-Received": "by 2002:a05:6830:6313:b0:7d7:ecee:af6b with SMTP id\n 46e09a7af769-7dbb793f2a4mr2478605a34.2.1775231185533;\n Fri, 03 Apr 2026 08:46:25 -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 closing a Chip multiple\n times", "Date": "Fri, 3 Apr 2026 10:46:04 -0500", "Message-ID": "<20260403154604.3944747-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 `Chip.close` to follow this example.\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/chip.py | 6 +++---\n bindings/python/tests/tests_chip.py | 8 --------\n 2 files changed, 3 insertions(+), 11 deletions(-)", "diff": "diff --git a/bindings/python/gpiod/chip.py b/bindings/python/gpiod/chip.py\nindex 8113fa9..6b7b32b 100644\n--- a/bindings/python/gpiod/chip.py\n+++ b/bindings/python/gpiod/chip.py\n@@ -99,9 +99,9 @@ class Chip:\n Close the associated GPIO chip descriptor. The chip object must no\n longer be used after this method is called.\n \"\"\"\n- self._check_closed()\n- cast(\"_ext.Chip\", self._chip).close()\n- self._chip = None\n+ if self._chip is not None:\n+ self._chip.close()\n+ self._chip = None\n \n def get_info(self) -> ChipInfo:\n \"\"\"\ndiff --git a/bindings/python/tests/tests_chip.py b/bindings/python/tests/tests_chip.py\nindex d5a64b3..9007885 100644\n--- a/bindings/python/tests/tests_chip.py\n+++ b/bindings/python/tests/tests_chip.py\n@@ -184,14 +184,6 @@ class ClosedChipCannotBeUsed(TestCase):\n with chip:\n _ = chip.fd\n \n- def test_close_chip_twice(self) -> None:\n- sim = gpiosim.Chip(label=\"foobar\")\n- chip = gpiod.Chip(sim.dev_path)\n- chip.close()\n-\n- with self.assertRaises(gpiod.ChipClosedError):\n- chip.close()\n-\n \n class StringRepresentation(TestCase):\n def setUp(self) -> None:\n", "prefixes": [ "libgpiod", "v2" ] }