From: Vincent Fazio <vfazio@gmail.com>
To: linux-gpio@vger.kernel.org
Cc: brgl@kernel.org, Vincent Fazio <vfazio@gmail.com>
Subject: [libgpiod][PATCH v2 0/8] bindings: python: modernize C extensions
Date: Thu, 23 Apr 2026 17:21:17 -0500 [thread overview]
Message-ID: <20260423222125.29097-1-vfazio@gmail.com> (raw)
This series performs some minor cleanup of the C extension modules and
migrates the module defintions to multi-phase intitialization (PEP 489).
Patches 1 & 2 avoid calling back into python to perform C level object
cleanup.
Patch 3 introduces no real functional change but simplifies the code to
get the same result.
Patch 4 applies suggestions from from a utility maintained by a CPython
core developer to help modernize macro/function usage.
Patch 5 conditionally compiles support for using a standard CPython
function over a backported version bundled within the C extension.
Patches 6-8 migrate the C extensions to use multi-phase initialization
as described in PEP 489 [0]. While not strictly necessary for enabling
free-threaded builds, it makes adding support more straighforward and
sets the stage for both PEP 793 [1] which soft-deprecates PyInit_* and
PEP 803 [2] which could simplify wheel builds.
Patches have been tested against the full matrix of supported versions:
https://github.com/vfazio/libgpiod/actions/runs/24860932220
[0]: https://peps.python.org/pep-0489/
[1]: https://peps.python.org/pep-0793/
[2]: https://peps.python.org/pep-0803/
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
Changes in v2:
- Dropped "bindings: python: use Py_RETURN_NONE in chip_get_line_name" (Bartosz)
- Adjusted patch 4 to simplify Py_None strong reference acquisition
- Updated link to passing pipeline
- Link to v1: https://lore.kernel.org/all/20260422012041.39933-1-vfazio@gmail.com/
---
Vincent Fazio (8):
bindings: python: avoid PyObject_CallMethod during chip finalize
bindings: python: avoid PyObject_CallMethod during request finalize
bindings: python: simplify disallowing _ext.Request from being created
bindings: python: use suggestions from upgrade_pythoncapi.py
bindings: python: use PyImport_ImportModuleAttrString when available
bindings: python: migrate the gpiod._ext module to multi-phase init
bindings: python: tests: migrate the system module to multi-phase init
bindings: python: tests: migrate the gpiosim module to multi-phase
init
bindings/python/gpiod/ext/chip.c | 29 ++---
bindings/python/gpiod/ext/common.c | 5 +-
bindings/python/gpiod/ext/internal.h | 10 +-
bindings/python/gpiod/ext/module.c | 68 ++++++------
bindings/python/gpiod/ext/request.c | 26 ++---
bindings/python/tests/gpiosim/ext.c | 153 +++++++++++++++++----------
bindings/python/tests/system/ext.c | 7 +-
7 files changed, 171 insertions(+), 127 deletions(-)
--
2.43.0
next reply other threads:[~2026-04-23 22:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 22:21 Vincent Fazio [this message]
2026-04-23 22:21 ` [libgpiod][PATCH v2 1/8] bindings: python: avoid PyObject_CallMethod during chip finalize Vincent Fazio
2026-04-23 22:21 ` [libgpiod][PATCH v2 2/8] bindings: python: avoid PyObject_CallMethod during request finalize Vincent Fazio
2026-04-23 22:21 ` [libgpiod][PATCH v2 3/8] bindings: python: simplify disallowing _ext.Request from being created Vincent Fazio
2026-04-23 22:21 ` [libgpiod][PATCH v2 4/8] bindings: python: use suggestions from upgrade_pythoncapi.py Vincent Fazio
2026-04-23 22:21 ` [libgpiod][PATCH v2 5/8] bindings: python: use PyImport_ImportModuleAttrString when available Vincent Fazio
2026-04-23 22:21 ` [libgpiod][PATCH v2 6/8] bindings: python: migrate the gpiod._ext module to multi-phase init Vincent Fazio
2026-04-23 22:21 ` [libgpiod][PATCH v2 7/8] bindings: python: tests: migrate the system " Vincent Fazio
2026-04-24 9:03 ` Bartosz Golaszewski
2026-04-24 9:05 ` Bartosz Golaszewski
2026-04-24 9:07 ` Bartosz Golaszewski
2026-04-23 22:21 ` [libgpiod][PATCH v2 8/8] bindings: python: tests: migrate the gpiosim " Vincent Fazio
2026-04-24 9:14 ` [libgpiod][PATCH v2 0/8] bindings: python: modernize C extensions Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260423222125.29097-1-vfazio@gmail.com \
--to=vfazio@gmail.com \
--cc=brgl@kernel.org \
--cc=linux-gpio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox