{"id":2227554,"url":"http://patchwork.ozlabs.org/api/1.1/covers/2227554/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/cover/20260423222125.29097-1-vfazio@gmail.com/","project":{"id":42,"url":"http://patchwork.ozlabs.org/api/1.1/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":""},"msgid":"<20260423222125.29097-1-vfazio@gmail.com>","date":"2026-04-23T22:21:17","name":"[libgpiod,v2,0/8] bindings: python: modernize C extensions","submitter":{"id":78694,"url":"http://patchwork.ozlabs.org/api/1.1/people/78694/?format=json","name":"Vincent Fazio","email":"vfazio@gmail.com"},"mbox":"http://patchwork.ozlabs.org/project/linux-gpio/cover/20260423222125.29097-1-vfazio@gmail.com/mbox/","series":[{"id":501257,"url":"http://patchwork.ozlabs.org/api/1.1/series/501257/?format=json","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/covers/2227554/comments/","headers":{"Return-Path":"\n <linux-gpio+bounces-35432-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=AGYr+H72;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-gpio+bounces-35432-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=\"AGYr+H72\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.160.41","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 sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::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 4g1rDM1Xfcz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 08:21:55 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 4FAB630055C3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 22:21:51 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id CF60733EAEC;\n\tThu, 23 Apr 2026 22:21:49 +0000 (UTC)","from mail-oa1-f41.google.com (mail-oa1-f41.google.com\n [209.85.160.41])\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 56DB62D6407\n\tfor <linux-gpio@vger.kernel.org>; Thu, 23 Apr 2026 22:21:48 +0000 (UTC)","by mail-oa1-f41.google.com with SMTP id\n 586e51a60fabf-40427db1300so5455929fac.0\n        for <linux-gpio@vger.kernel.org>;\n Thu, 23 Apr 2026 15:21:48 -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.46\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Thu, 23 Apr 2026 15:21:46 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776982909; cv=none;\n b=vCEJbDQ4smK25CW8NXp8hPEwpB3SLWbwIc0KmcGWJMgnNNynByRwRM2kTuVU7CitJU83PQ9JhQ2s4B/yxDz7xUmkRCjk8Hl72PYm4Iqk+hNs1Vlg47kzwjeqkPkK7IJEuVqnmmQFLFk8vv6XUftytOTWrDc2GSFQF4RW2Up1wyE=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776982909; c=relaxed/simple;\n\tbh=XgyeyPimgkNpizlW638YP4I86xaSrI+4b/FsVNHNFQo=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=IepH81A3mE9bcZhSXD95FkNWWyUdGSc2H53dxxKMTik0h59WVulUb1OwhozL0uBv5abKZKGOSaxRqGJH1l+0LieaXlnVZb9i2TpyhVSWH/hFJLukvatZqkLzDcOXucTEGmwbnM56b4gnMeDAGGeJi5ysePkW/WFosDKzne4/eeo=","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=AGYr+H72; arc=none smtp.client-ip=209.85.160.41","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1776982907; x=1777587707;\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=tvRqQz28GgwGSdDRIEbbeoOKkXVV3dg0BBIJfA0mca4=;\n        b=AGYr+H72JvXTr9EtfD8P5FRi65L9eacf4ulbvKeZSebZeeiaQtGAgdIAs0vJPePPLm\n         uqyRwBEmgMxL67pu+MUdufrop9zYYZBFH3is/1vflpKjFOYmuA9mYtgOPofsbgkCsigv\n         HuLUcqRG0Xzrj+ybxmiQ7YKCcS51/kKBEHj5kV0pVJLykal+jH1uGirXXSSxhMr2UxZY\n         enjrWh1UhGzz5Qb1UyLZJf1jsq+vDoXMOgUinoR6LIgq5r3F9gHuW1mXlqwykuroNudN\n         pZvl0vuENxlTp4E9/4kODik5i/0Fs/xRLUrlX2q2pJCP0YCY+Tkl8B+n3MztjY/oDV98\n         xXkw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776982907; x=1777587707;\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=tvRqQz28GgwGSdDRIEbbeoOKkXVV3dg0BBIJfA0mca4=;\n        b=OUBvLupWcLOeBznO1TRCMK8Imm9Doha+8V28tWxwIDCRhbHYXhI4ejovQnoXBjnfPy\n         gh4mNpLgByiQBtefeOlVCdnxXAcjXENDtwv7LVDuEIXOSE8fPImIVvuBta4/aG1xv7Vp\n         PGJvL/l0AjBrOkT1rKuQkjVpxIPnowK9cd1fHXifHv/5IwciXTrUQjpHiEMcfB8M95rZ\n         pgP/zfjpNa3TKrpBA6e3JrANwIu/JLckobCyWRbFod+9UNgkErx6MiZshaVVpcadHhvT\n         q8VA7IB7rOfzIqBW4o/kQV4wAafeSHCVVYZtapPxcwpG5RNXMXdCBruYO+ycA4azNYhB\n         icfg==","X-Gm-Message-State":"AOJu0YyXRXFUBEUv0Rc5tA+wbglchnsKFsjJFGIEglML5/DY9XBbkcB3\n\tOHEnbR0MJwLfnegJxsuZWAzDZiRMknweDBhvFML7k7Zlc0zAwXcqN9n5VPFqUw==","X-Gm-Gg":"AeBDiet0gIQNUfTb8iPf3fN33GWJ75ViPMr+QtEU4JuM7efyFy5MpJFx9Qdonz2CZnP\n\tcNvK7W+OjngbKwYmd/gA3hEmoq84sv4QuiADJGSkbKyvKyPi3IYn8v5G/lYNY/oZ973d6TeUdCp\n\t/MYoAUpFQ+jr2KK1kqanz8vhou5zIjGPYQKVTio8Htpk7rZ+L3jT+eqL5WJvEJ0mU0XveVt+sgJ\n\tA4Rv3yxWxkd3SBEr3Dy2qQWPDLShyqtivN9iN7tZrKgKSolOc8f4BFBNEyQPi7OqHQyNCe2edsG\n\t7CCzdUOGmctuJVCHKnt5cPazWAkqA3FG/Khs4taJSNbd8tf1qIN8s3vSOv4d3pDRmkORf0icK1h\n\teYB6Xc+jovEYBAxL/mcPDvLsFN7eML7hiDh5OKbDdfOCFM2I4jsJa78en9xmV2qS7Z/huetHznd\n\tpZDHWBYkihCcGOqZETK8RmPbT6s0VhvoeKXVz/ztS4Fz7qJBRgN7Fp+bE7DJH7ZwHBGdmpqE9X","X-Received":"by 2002:a05:6870:7a0f:b0:41c:bab:5f9d with SMTP id\n 586e51a60fabf-42abf23972amr19016731fac.4.1776982906898;\n        Thu, 23 Apr 2026 15:21:46 -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 0/8] bindings: python: modernize C extensions","Date":"Thu, 23 Apr 2026 17:21:17 -0500","Message-ID":"<20260423222125.29097-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":"This series performs some minor cleanup of the C extension modules and\nmigrates the module defintions to multi-phase intitialization (PEP 489).\n\nPatches 1 & 2 avoid calling back into python to perform C level object\ncleanup.\n\nPatch 3 introduces no real functional change but simplifies the code to\nget the same result.\n\nPatch 4 applies suggestions from from a utility maintained by a CPython\ncore developer to help modernize macro/function usage.\n\nPatch 5 conditionally compiles support for using a standard CPython\nfunction over a backported version bundled within the C extension.\n\nPatches 6-8 migrate the C extensions to use multi-phase initialization\nas described in PEP 489 [0]. While not strictly necessary for enabling\nfree-threaded builds, it makes adding support more straighforward and\nsets the stage for both PEP 793 [1] which soft-deprecates PyInit_* and\nPEP 803 [2] which could simplify wheel builds.\n\nPatches have been tested against the full matrix of supported versions:\n  https://github.com/vfazio/libgpiod/actions/runs/24860932220\n\n[0]: https://peps.python.org/pep-0489/\n[1]: https://peps.python.org/pep-0793/\n[2]: https://peps.python.org/pep-0803/\n\nSigned-off-by: Vincent Fazio <vfazio@gmail.com>\n---\nChanges in v2:\n- Dropped \"bindings: python: use Py_RETURN_NONE in chip_get_line_name\" (Bartosz)\n- Adjusted patch 4 to simplify Py_None strong reference acquisition\n- Updated link to passing pipeline\n- Link to v1: https://lore.kernel.org/all/20260422012041.39933-1-vfazio@gmail.com/\n---\n\nVincent Fazio (8):\n  bindings: python: avoid PyObject_CallMethod during chip finalize\n  bindings: python: avoid PyObject_CallMethod during request finalize\n  bindings: python: simplify disallowing _ext.Request from being created\n  bindings: python: use suggestions from upgrade_pythoncapi.py\n  bindings: python: use PyImport_ImportModuleAttrString when available\n  bindings: python: migrate the gpiod._ext module to multi-phase init\n  bindings: python: tests: migrate the system module to multi-phase init\n  bindings: python: tests: migrate the gpiosim module to multi-phase\n    init\n\n bindings/python/gpiod/ext/chip.c     |  29 ++---\n bindings/python/gpiod/ext/common.c   |   5 +-\n bindings/python/gpiod/ext/internal.h |  10 +-\n bindings/python/gpiod/ext/module.c   |  68 ++++++------\n bindings/python/gpiod/ext/request.c  |  26 ++---\n bindings/python/tests/gpiosim/ext.c  | 153 +++++++++++++++++----------\n bindings/python/tests/system/ext.c   |   7 +-\n 7 files changed, 171 insertions(+), 127 deletions(-)"}