python-ubus: backport patch for newer Python

Build is failing for a while now with error:
```
14.3.0_musl/usr/include -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-mipsel_24kc_gcc-14.3.0_musl/include -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-mipsel_24kc_gcc-14.3.0_musl/include/fortify -I/builder/shared-workdir/build/sdk/staging_dir/target-mipsel_24kc_musl/usr/include/python3.14 -fPIC -I/builder/shared-workdir/build/sdk/staging_dir/target-mipsel_24kc_musl/usr/include/python3.14 -c ./ubus_python.c -o build/temp.linux-mipsel-cpython-314/ubus_python.o
./ubus_python.c: In function 'ubus_python_add':
./ubus_python.c:1081:17: error: implicit declaration of function 'PyEval_CallMethod'; did you mean 'PyObject_CallMethod'? [-Wimplicit-function-declaration]
 1081 |                 PyEval_CallMethod(python_alloc_list, "pop", "");
      |                 ^~~~~~~~~~~~~~~~~
      |                 PyObject_CallMethod
error: command '/builder/shared-workdir/build/sdk/staging_dir/toolc
```

This has been fixed on version 0.1.3, but that hasn't been
published to pypi yet.

Also add test.sh

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
Alexandru Ardelean
2026-04-10 18:30:15 +03:00
committed by Alexandru Ardelean
parent 7e99a65d72
commit 29e685e1f8
3 changed files with 60 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
From e76b4f915c80d0fdfdd6602593b1f7bd7e078c3b Mon Sep 17 00:00:00 2001
From: Stepan Henek <stepan.henek@nic.cz>
Date: Thu, 5 Mar 2026 12:38:21 +0100
Subject: [PATCH] make project compatible with python3.13
---
ubus_python.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/ubus_python.c
+++ b/ubus_python.c
@@ -1078,7 +1078,8 @@ static PyObject *ubus_python_add(PyObjec
if (PyList_Append(python_alloc_list, methods)) {
ubus_remove_object(ctx, &object->object);
free_ubus_object(object);
- PyEval_CallMethod(python_alloc_list, "pop", "");
+ PyObject *_pop_result = PyObject_CallMethod(python_alloc_list, "pop", NULL);
+ Py_XDECREF(_pop_result);
return NULL;
}