Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2227557/?format=api
{ "id": 2227557, "url": "http://patchwork.ozlabs.org/api/patches/2227557/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260423222125.29097-5-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": "<20260423222125.29097-5-vfazio@gmail.com>", "list_archive_url": null, "date": "2026-04-23T22:21:21", "name": "[libgpiod,v2,4/8] bindings: python: use suggestions from upgrade_pythoncapi.py", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "779470cdd4a64418ab5761bb3077a029489ff52f", "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/20260423222125.29097-5-vfazio@gmail.com/mbox/", "series": [ { "id": 501257, "url": "http://patchwork.ozlabs.org/api/series/501257/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=501257", "date": "2026-04-23T22:21:18", "name": "bindings: python: modernize C extensions", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/501257/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227557/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227557/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-gpio+bounces-35436-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=oUaBoo8N;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-gpio+bounces-35436-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=\"oUaBoo8N\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.210.50", "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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1rDP4C0Yz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 08:21:57 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 10127301D319\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 22:21:54 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id DA8473537E1;\n\tThu, 23 Apr 2026 22:21:53 +0000 (UTC)", "from mail-ot1-f50.google.com (mail-ot1-f50.google.com\n [209.85.210.50])\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 39EB92D6407\n\tfor <linux-gpio@vger.kernel.org>; Thu, 23 Apr 2026 22:21:52 +0000 (UTC)", "by mail-ot1-f50.google.com with SMTP id\n 46e09a7af769-7dcc9b506d9so4034220a34.1\n for <linux-gpio@vger.kernel.org>;\n Thu, 23 Apr 2026 15:21:52 -0700 (PDT)", "from Zephyrus.localdomain ([131.93.209.211])\n by smtp.gmail.com with ESMTPSA id\n 586e51a60fabf-42b930afa63sm17784598fac.5.2026.04.23.15.21.50\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 23 Apr 2026 15:21:50 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776982913; cv=none;\n b=T6LqiW4DUO0RKP0E0Dfw2uzn5fbbmvkAxKXXoIzDD9PXQHbbEy4FwSvueciBOeuugZRheD2C0bIMdyad1yWjk3RO3twue6jTFsHy10tGXFMim47zwjnMuk7yBhDDKBADoZrSB70tIyUhkuxOXcVNnBvFHxd4gyDMVev322KvEoM=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776982913; c=relaxed/simple;\n\tbh=B+h6Z7DC4PubRsgB/GI4oeNGWHyyguTG5D4OqbTTN94=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=YXxZVajKqkEJvMCM+Ieqo7iQ1W1h6v+wKwDs++gtW64fUwaBhPBbfuX9IaUtwjfFdvDMTiE/SYKSsRGGXE9Y8w021bIQpCF1uTSm+FxGKYpZRZsHcVlq4RzFxlA9eNP6j0oUYXS5J2dnVMEGDqoXl7LpXLCOmhtFvX6Sdnq5ob0=", "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=oUaBoo8N; arc=none smtp.client-ip=209.85.210.50", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776982911; x=1777587711;\n darn=vger.kernel.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=Hjh9E29+2vOtbDSF8a0lhnexApbQFUzqT/Sl0VtxCB0=;\n b=oUaBoo8NWfP4PauXjbKGQWMWyZMWKeFmPd5kgutcpMz0c//yjzfBvPL3/68fB/QUEZ\n 5+/ITRG+uEtg7tcAiWLHdYJO4LtrQExzwkGwnSYQZoqJb6MmG1lDovrIChrfw47jiutA\n CBxtcgmfhMm15gP3MXUwXB/Uy6yUe7zj/T2wRlsMzR66GpXzhBn6NfOa2oHTNV+sdi4f\n AnVA/5yu355D779F25laPCF0ETOoUtL3Vi5zOfgzNegcBrC7AQ8EogrvK733jpwS1cdo\n bPtSDAzG3ZiheM0axudbqAl9y+IKOkqg1EFIuO6npQxIqlRCKtZP4Y5VismmR2zrZ5DC\n JQCw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776982911; x=1777587711;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=Hjh9E29+2vOtbDSF8a0lhnexApbQFUzqT/Sl0VtxCB0=;\n b=LnGQzECZqIJJlxSLAGJoeQv1OCyQCgceDy2kjNbKYGC55EINRSprpI8JyvOivCpw/Q\n JYfgVMdOGn1dNLFPwnQOvvIdjl8vk2XgYmTr3q2BwuHxkwT50+Ro60HHzy9+qH5HOQuC\n YUKkjGXl/47PhsjObSmOTiCDdv40Q8ZLy87gRkjHm0aKWv+ke8lx5XQ2L4o6SKWd4pin\n 964BpqI1M9u9ETrrjfB0bv5KrT6miZFDnv1DWs6CZfgUv4DN0JaY8p789EiHY6LJki9D\n j1pjPmGM2fABTBoxrsoCteJUjZFVEjzB0ewFoDO2D56lkdEQ315N5vAZnudL2tTVyc6+\n QkrA==", "X-Gm-Message-State": "AOJu0Yxl4/gOBonHg8WY43QDK0ciobJjdX6pQlkIjFmWv6x4+ByWAPCn\n\tYAOtAU3Hl0Rv18/88/8h/1OrPz0WLa/qYeYVgJlNBsbEG8Rx117qK6w20b7jrA==", "X-Gm-Gg": "AeBDieulouic2NEEfyZoURdM9YbeYg+O/8+nY1k+xf35EyLSHbPzEboS1kWDO4C2OdO\n\tb2YN5SYskFzNFU/fe7nenff+y9BLXKsQkAT3QU7DksJcK6GckxFLL2OKX2EpSzgHwrAFTQrldKl\n\tfzNNqGOL82WXo9x3JvsokJobnWxVL5GGPbTh9vpiXIcP6ro10rvpyX8lyRWkNFcyVaCoGaiDJtp\n\tqeaO5pnTAhHRw87ioKsDpExgG4CVk6Oyrn398v/gxU7bcfgW+mt5ZxUDPjq6LqVGdp93fuRBMt/\n\tVoHvCjH9mzl1Mvf9K4DJ8ZG6jr38M0NlaGtXNOIYZM3ot3v3lS9dchlkt1Tdg27qgilzFzY9iLu\n\tNDeAR2J68R4KZ95fH+Wz8/Te444yMC7/R9WTK9R07E7P8X8Xez/XHrRyX9rs3HECCv72UAhTLB/\n\ty7ft7nvnZ86m03tUm1me2LLcfLUgzOZD0h6iPPyOZTjbmLqlzSMFw7v9MIpFYDR0zIn8Vvp8lr", "X-Received": "by 2002:a05:6820:1793:b0:694:926b:551 with SMTP id\n 006d021491bc7-694926b0c46mr9650483eaf.55.1776982910925;\n Thu, 23 Apr 2026 15:21:50 -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 4/8] bindings: python: use suggestions from\n upgrade_pythoncapi.py", "Date": "Thu, 23 Apr 2026 17:21:21 -0500", "Message-ID": "<20260423222125.29097-5-vfazio@gmail.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260423222125.29097-1-vfazio@gmail.com>", "References": "<20260423222125.29097-1-vfazio@gmail.com>", "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": "The upgrade_pythoncapi.py script performs transforms on C extension\nsources to use new syntax [0]. It's generally used with a shim header\nfor compatibility, but the header is not necessary for these changes.\n\nThe suggested changes are:\n\n * Use the `Py_IsNone` function introduced in CPython 3.10 [1] over\n direct comparison to `Py_None`\n\n * Use `PyObject_Free` instead of `PyObject_Del` since `PyObject_Del`\n has been aliased to `PyObject_Free` for nearly 24 years [2] and has\n been announced as deprecated [3]\n\n * Use the `Py_NewRef` function introduced in CPython 3.10 [4] to\n increment and return a new reference.\n\n[0]: https://pythoncapi-compat.readthedocs.io/en/latest/index.html\n[1]: https://github.com/python/cpython/commit/09bbebea163fe7303264cf4069c51d4d2f22fde4\n[2]: https://github.com/python/cpython/commit/3e7b893899bdaa294a72e894694b099a1d370765\n[3]: https://docs.python.org/3/c-api/allocation.html#deprecated-aliases\n[4]: https://github.com/python/cpython/commit/53a03aafd5812018a3821a2e83063fd3d6cd2576\n\nSigned-off-by: Vincent Fazio <vfazio@gmail.com>\n---\n bindings/python/gpiod/ext/chip.c | 11 +++--------\n bindings/python/gpiod/ext/common.c | 2 +-\n bindings/python/gpiod/ext/request.c | 2 +-\n bindings/python/tests/gpiosim/ext.c | 2 +-\n 4 files changed, 6 insertions(+), 11 deletions(-)", "diff": "diff --git a/bindings/python/gpiod/ext/chip.c b/bindings/python/gpiod/ext/chip.c\nindex be20869..4d96dd8 100644\n--- a/bindings/python/gpiod/ext/chip.c\n+++ b/bindings/python/gpiod/ext/chip.c\n@@ -172,12 +172,7 @@ static PyObject *chip_get_line_name(chip_object *self, PyObject *args)\n \t\treturn Py_gpiod_SetErrFromErrno();\n \n \tname = gpiod_line_info_get_name(info);\n-\tif (!name) {\n-\t\tPy_INCREF(Py_None);\n-\t\tline_name = Py_None;\n-\t} else {\n-\t\tline_name = PyUnicode_FromString(name);\n-\t}\n+\tline_name = (name) ? PyUnicode_FromString(name) : Py_NewRef(Py_None);\n \n \tgpiod_line_info_free(info);\n \n@@ -272,7 +267,7 @@ make_request_config(PyObject *consumer_obj, PyObject *event_buffer_size_obj)\n \t\treturn NULL;\n \t}\n \n-\tif (consumer_obj != Py_None) {\n+\tif (!Py_IsNone(consumer_obj)) {\n \t\tconsumer = PyUnicode_AsUTF8(consumer_obj);\n \t\tif (!consumer) {\n \t\t\tgpiod_request_config_free(req_cfg);\n@@ -282,7 +277,7 @@ make_request_config(PyObject *consumer_obj, PyObject *event_buffer_size_obj)\n \t\tgpiod_request_config_set_consumer(req_cfg, consumer);\n \t}\n \n-\tif (event_buffer_size_obj != Py_None) {\n+\tif (!Py_IsNone(event_buffer_size_obj)) {\n \t\tevent_buffer_size = PyLong_AsSize_t(event_buffer_size_obj);\n \t\tif (PyErr_Occurred()) {\n \t\t\tgpiod_request_config_free(req_cfg);\ndiff --git a/bindings/python/gpiod/ext/common.c b/bindings/python/gpiod/ext/common.c\nindex 62201b6..7d2dda7 100644\n--- a/bindings/python/gpiod/ext/common.c\n+++ b/bindings/python/gpiod/ext/common.c\n@@ -12,7 +12,7 @@ void Py_gpiod_dealloc(PyObject *self)\n \tif (ret < 0)\n \t\treturn;\n \n-\tPyObject_Del(self);\n+\tPyObject_Free(self);\n }\n \n PyObject *Py_gpiod_SetErrFromErrno(void)\ndiff --git a/bindings/python/gpiod/ext/request.c b/bindings/python/gpiod/ext/request.c\nindex 9940382..46e07ae 100644\n--- a/bindings/python/gpiod/ext/request.c\n+++ b/bindings/python/gpiod/ext/request.c\n@@ -286,7 +286,7 @@ static PyObject *request_read_edge_events(request_object *self, PyObject *args)\n \tif (!ret)\n \t\treturn NULL;\n \n-\tif (max_events_obj != Py_None) {\n+\tif (!Py_IsNone(max_events_obj)) {\n \t\tmax_events = PyLong_AsSize_t(max_events_obj);\n \t\tif (PyErr_Occurred())\n \t\t\treturn NULL;\ndiff --git a/bindings/python/tests/gpiosim/ext.c b/bindings/python/tests/gpiosim/ext.c\nindex cb5611a..1ebd5af 100644\n--- a/bindings/python/tests/gpiosim/ext.c\n+++ b/bindings/python/tests/gpiosim/ext.c\n@@ -116,7 +116,7 @@ static void chip_dealloc(PyObject *self)\n \tif (ret < 0)\n \t\treturn;\n \n-\tPyObject_Del(self);\n+\tPyObject_Free(self);\n }\n \n static PyObject *chip_dev_path(chip_object *self, void *Py_UNUSED(ignored))\n", "prefixes": [ "libgpiod", "v2", "4/8" ] }