Vincent Fazio
c9378d6c63
bindings: python: support free-threaded CPython
...
PEP 703 [0] discusses making the GIL optional in certain builds of the
CPython interpreter.
This build option was available experiementally in Python 3.13 but has
since been stabilized in Python 3.14 per PEP 779 [1].
According to the porting guide [2], there is no strict requirement that
C extensions must be thread-safe.
Experiments have shown that no logic changes are required if callers
use sychronization mechanisms provided by the Python standard library.
The documentation has been updated to call this out specifically using
terminology from the porting guide [3].
[0]: https://peps.python.org/pep-0703/
[1]: https://peps.python.org/pep-0779/
[2]: https://py-free-threading.github.io/porting/#define-and-document-thread-safety-guarantees
[3]: https://py-free-threading.github.io/documentation-principles/#free-threading-terminology
Signed-off-by: Vincent Fazio <vfazio@gmail.com >
Link: https://patch.msgid.link/20260527215922.18678-3-vfazio@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com >
2026-05-28 10:59:30 +02:00
Vincent Fazio
bf4211f3e1
bindings: python: tests: migrate the system module to multi-phase init
...
Single-phase initialization has been classified as legacy within CPython
documentation [0] with multi-phase being its successor [1].
As such, switch to the new methodology.
[0]: https://docs.python.org/3/c-api/extension-modules.html#legacy-single-phase-initialization
[1]: https://docs.python.org/3/c-api/extension-modules.html#multi-phase-initialization
Signed-off-by: Vincent Fazio <vfazio@gmail.com >
Link: https://patch.msgid.link/20260423222125.29097-8-vfazio@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com >
2026-04-24 11:07:35 +02:00
Bartosz Golaszewski
db19ece3c5
bindings: python: tests: provide and use system.check_kernel_version()
...
We claim that libgpiod python bindings have no dependencies other than
the python standard library but this is not true - the tests do depend
on deprecated distutils for kernel version parsing.
As distutils is deprecated, the recommended improvement is to use the
Version class from packaging.version but this would too entail pulling
in an external module.
Let's instead implement the kernel version check in C using uname() and
put it into the tests.system extension. This allows us to entirely drop
the distutils import.
Reviewed-by: Vincent Fazio <vfazio@xes-inc.com >
Link: https://lore.kernel.org/r/20241120-drop-distutils-v1-3-7498e8b3babe@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org >
2024-11-25 10:03:54 +01:00
Bartosz Golaszewski
aa5a1e92b1
bindings: python: tests: rename procname to system
...
We'll be extending the functionality of that C extension with other
OS-level helpers so change its name to 'system'.
Reviewed-by: Vincent Fazio <vfazio@xes-inc.com >
Link: https://lore.kernel.org/r/20241120-drop-distutils-v1-2-7498e8b3babe@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org >
2024-11-25 10:03:50 +01:00