Skip to contentSkip to conversation

Revert "bindings: python: replace PyModule_AddObjectRef() with PyModule_AddObject()"

PATCH Applied Bartosz Golaszewski 2 participants 3 messages Mar 30 – Mar 31 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "bindings: python: replace PyModule_AddObjectRef() with PyModule_AddObject()"

This reverts commit b436d05809b17ed734d08a36a8913eb687506433.

Commit 950ff3d1b300 ("bindings: python: drop python 3.9 support") removed support for python v3.9 and with v3.10 now being the minimum required version, we're now free to use PyModule_AddObjectRef().

---
 bindings/python/gpiod/ext/module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bindings/python/gpiod/ext/module.c +2 -2
index b456190..25c252a 100644
@@ -178,9 +178,9 @@ PyMODINIT_FUNC PyInit__ext(void)
 		return NULL;
 	}
 
-	ret = PyModule_AddObject(module, "__all__", all);
+	ret = PyModule_AddObjectRef(module, "__all__", all);
+	Py_DECREF(all);
 	if (ret) {
-		Py_DECREF(all);
 		Py_DECREF(module);
 		return NULL;
 	}
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Bartosz Golaszewski <[email protected]>
Sent: Monday, March 30, 2026 7:50 AM
To: Linus Walleij <[email protected]>; Bartosz Golaszewski <[email protected]>; Vincent Fazio <[email protected]>
Cc: [email protected]; Bartosz Golaszewski <[email protected]>
Subject: [libgpiod][PATCH] Revert "bindings: python: replace PyModule_AddObjectRef() with PyModule_AddObject()"

Quoted 8 lines

This reverts commit b436d05809b17ed734d08a36a8913eb687506433.

Commit 950ff3d1b300 ("bindings: python: drop python 3.9 support") removed support for python v3.9 and with v3.10 now being the minimum required version, we're now free to use PyModule_AddObjectRef().

Signed-off-by: Bartosz Golaszewski
<[email protected]>

author Applied
#2 lore raw
In reply to Bartosz Golaszewski
Quoted 8 lines · Bartosz Golaszewski

This reverts commit b436d05809b17ed734d08a36a8913eb687506433.

Commit 950ff3d1b300 ("bindings: python: drop python 3.9 support") removed support for python v3.9 and with v3.10 now being the minimum required version, we're now free to use PyModule_AddObjectRef().

[...]

Applied, thanks!

[1/1] Revert "bindings: python: replace PyModule_AddObjectRef() with PyModule_AddObject()"

      https://git.kernel.org/brgl/c/2e47ad76bc66c2abfb02e4b9d3982fa246af07e0

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>