diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2023-10-09 21:02:52 +0200 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2023-10-11 10:02:09 +0200 |
commit | b436d05809b17ed734d08a36a8913eb687506433 (patch) | |
tree | 51d6b404dc2eb090ca9b205620c77d9a86bb0fc4 | |
parent | acebcf2cbefb735eaddc06ee52eb1b1c85886d1b (diff) | |
download | libgpiod-b436d05809b17ed734d08a36a8913eb687506433.tar.gz |
bindings: python: replace PyModule_AddObjectRef() with PyModule_AddObject()
PyModule_AddObjectRef() was added in cpython v3.10 while libgpiod claims
to depend on python v3.9. Replace it with an older variant that steals the
reference to the added object on success.
Reported-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-rw-r--r-- | bindings/python/gpiod/ext/module.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bindings/python/gpiod/ext/module.c b/bindings/python/gpiod/ext/module.c index 25c252a7..b4561904 100644 --- a/bindings/python/gpiod/ext/module.c +++ b/bindings/python/gpiod/ext/module.c @@ -178,9 +178,9 @@ PyMODINIT_FUNC PyInit__ext(void) return NULL; } - ret = PyModule_AddObjectRef(module, "__all__", all); - Py_DECREF(all); + ret = PyModule_AddObject(module, "__all__", all); if (ret) { + Py_DECREF(all); Py_DECREF(module); return NULL; } |