From f9e2c54042729f7a7cc938b16902676c7e42d203 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 8 Jan 2025 15:14:39 +0100 Subject: [PATCH 1/6] python: replace removed module pipes with shlex https://docs.python.org/3/whatsnew/3.13.html#pep-594-remove-dead-batteries-from-the-standard-library --- plugins/wb.admin/backend/wb_server_management.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/wb.admin/backend/wb_server_management.py b/plugins/wb.admin/backend/wb_server_management.py index 40ed515d2..c89c98b6c 100644 --- a/plugins/wb.admin/backend/wb_server_management.py +++ b/plugins/wb.admin/backend/wb_server_management.py @@ -28,7 +28,7 @@ import threading import tempfile import io -import pipes +import shlex import subprocess import time import inspect @@ -511,7 +511,7 @@ def spawn_process(self, command, as_user=Users.CURRENT, user_password=None, outp return 0 def list2cmdline(self, args): - return " ".join([pipes.quote(a) or "''" for a in args]) + return " ".join([shlex.quote(a) or "''" for a in args]) _process_ops_classes.append(ProcessOpsLinuxLocal) @@ -592,7 +592,7 @@ def spawn_process(self, command, as_user=Users.CURRENT, user_password=None, outp def list2cmdline(self, args): - return " ".join([pipes.quote(a) or "''" for a in args]) + return " ".join([shlex.quote(a) or "''" for a in args]) _process_ops_classes.append(ProcessOpsLinuxRemote) From 5b5872063d7a56e3097f71e403ed770b19657a3a Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 8 Aug 2026 23:25:13 +0200 Subject: [PATCH 2/6] swig: replace SWIG_Python_AppendOutput() with SWIG_AppendOutput() https://github.com/swig/swig/commit/ea8aa84b28d67e28c3a4c9a798af7077b7a02cb0 --- library/forms/swig/cairo.i | 2 +- library/forms/swig/mforms.i | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/forms/swig/cairo.i b/library/forms/swig/cairo.i index a02efdcd1..1602b3f29 100644 --- a/library/forms/swig/cairo.i +++ b/library/forms/swig/cairo.i @@ -125,7 +125,7 @@ %typemap(argout) cairo_text_extents_t *extents { PyObject *o= SWIG_NewPointerObj(new cairo_text_extents_t(*$1), SWIGTYPE_p_cairo_text_extents_t, 0 | 0 ); - $result= SWIG_Python_AppendOutput($result, o); + $result= SWIG_AppendOutput($result, o); } %typemap(in) const char* (std::string s) { diff --git a/library/forms/swig/mforms.i b/library/forms/swig/mforms.i index ac4c6e36a..efb8d3966 100644 --- a/library/forms/swig/mforms.i +++ b/library/forms/swig/mforms.i @@ -722,7 +722,7 @@ inline boost::function pycall_void_entryaction_f %typemap(argout) std::string &ret_password { PyObject *o= PyUnicode_DecodeUTF8(($1)->data(), ($1)->size(), NULL); - $result= SWIG_Python_AppendOutput($result, o); + $result= SWIG_AppendOutput($result, o); } %typemap(in,numinputs=0) std::string &ret_password(std::string temp) { @@ -731,7 +731,7 @@ inline boost::function pycall_void_entryaction_f %typemap(argout) std::string &ret_value { PyObject *o= PyUnicode_DecodeUTF8(($1)->data(), ($1)->size(), NULL); - $result= SWIG_Python_AppendOutput($result, o); + $result= SWIG_AppendOutput($result, o); } %typemap(in,numinputs=0) std::string &ret_value(std::string temp) { @@ -741,7 +741,7 @@ inline boost::function pycall_void_entryaction_f %typemap(argout) bool &ret_store { if (*$1) Py_INCREF(Py_True); else Py_INCREF(Py_False); - $result= SWIG_Python_AppendOutput($result, *$1 ? Py_True : Py_False); + $result= SWIG_AppendOutput($result, *$1 ? Py_True : Py_False); } %typemap(in,numinputs=0) bool &ret_store(bool temp) { From 3e3defbf4e5cfdc52727919e9441153018192a8d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 8 Aug 2026 23:25:31 +0200 Subject: [PATCH 3/6] python: replace PyInt_* with PyLong_* The former existed for python 2.x, but are gone with pythong 3.x. To date it worked as swig did ship compatibility macros, but these are gone with swig 4.5.x. https://github.com/swig/swig/commit/79f7a2b7cb7ddc256eba09c8770133148025171d --- .../typesystem_ScintillaEdit.xml.template | 12 ++++++------ library/forms/swig/mforms.i | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/scintilla/qt/ScintillaEditPy/typesystem_ScintillaEdit.xml.template b/ext/scintilla/qt/ScintillaEditPy/typesystem_ScintillaEdit.xml.template index 60629559c..c70ff8fdf 100644 --- a/ext/scintilla/qt/ScintillaEditPy/typesystem_ScintillaEdit.xml.template +++ b/ext/scintilla/qt/ScintillaEditPy/typesystem_ScintillaEdit.xml.template @@ -17,7 +17,7 @@ greater than max value of an int --> - int margin = PyInt_AsLong(%PYARG_1); + int margin = PyLong_AsLong(%PYARG_1); if (margin == -1 && PyErr_Occurred()) return NULL; unsigned long mask = PyLong_AsUnsignedLongMask(%PYARG_2); @@ -30,16 +30,16 @@ - int margin = PyInt_AsLong(%PYARG_1); + int margin = PyLong_AsLong(%PYARG_1); if (margin == -1 && PyErr_Occurred()) return NULL; unsigned int mask = (unsigned int)%CPPSELF->get_margin_mask_n(margin); - %PYARG_0 = PyInt_FromSize_t(mask); + %PYARG_0 = PyLong_FromSize_t(mask); - int margin = PyInt_AsLong(%PYARG_1); + int margin = PyLong_AsLong(%PYARG_1); if (margin == -1 && PyErr_Occurred()) return NULL; unsigned long mask = PyLong_AsUnsignedLongMask(%PYARG_2); @@ -52,11 +52,11 @@ - int margin = PyInt_AsLong(%PYARG_1); + int margin = PyLong_AsLong(%PYARG_1); if (margin == -1 && PyErr_Occurred()) return NULL; unsigned int mask = (unsigned int)%CPPSELF->marginMaskN(margin); - %PYARG_0 = PyInt_FromSize_t(mask); + %PYARG_0 = PyLong_FromSize_t(mask); diff --git a/library/forms/swig/mforms.i b/library/forms/swig/mforms.i index efb8d3966..3117dc280 100644 --- a/library/forms/swig/mforms.i +++ b/library/forms/swig/mforms.i @@ -656,7 +656,7 @@ inline boost::function pycall_void_entryaction_f $result = PyList_New(0); for (std::vector::const_iterator iter = $1.begin(); iter != $1.end(); ++iter) { - PyList_Append($result, PyInt_FromLong(*iter)); + PyList_Append($result, PyLong_FromLong(*iter)); } } @@ -664,7 +664,7 @@ inline boost::function pycall_void_entryaction_f $result = PyList_New(0); for (std::vector::const_iterator iter = $1.begin(); iter != $1.end(); ++iter) { - PyList_Append($result, PyInt_FromLong(*iter)); + PyList_Append($result, PyLong_FromLong(*iter)); } } @@ -674,7 +674,7 @@ inline boost::function pycall_void_entryaction_f for (int c= PyList_Size($input), i= 0; i < c; i++) { PyObject *item = PyList_GetItem($input, i); - $1->push_back(PyInt_AsLong(item)); + $1->push_back(PyLong_AsLong(item)); } } else @@ -821,8 +821,8 @@ namespace std { PyObject *item = PyList_GetItem($input, i); if (PyFloat_Check(item)) $1.push_back(PyFloat_AsDouble(item)); - else if (PyInt_Check(item)) - $1.push_back(PyInt_AsLong(item)); + else if (PyLong_Check(item)) + $1.push_back(PyLong_AsLong(item)); else { SWIG_exception_fail(SWIG_TypeError, "expected list of doubles"); From c61bdda5efff5b9aeba28fd7ad998dafa3d4aa66 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 8 Aug 2026 23:25:13 +0200 Subject: [PATCH 4/6] python: replace PyString_FromString with PyUnicode_FromString The former existed for python 2.x, but are gone with pythong 3.x. To date it worked as swig did ship compatibility macros, but these are gone with swig 4.5.x. https://github.com/swig/swig/commit/79f7a2b7cb7ddc256eba09c8770133148025171d --- library/forms/swig/mforms.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/forms/swig/mforms.i b/library/forms/swig/mforms.i index 3117dc280..1c786e9e3 100644 --- a/library/forms/swig/mforms.i +++ b/library/forms/swig/mforms.i @@ -137,7 +137,7 @@ static void show_python_exception() std::string result; /* See if we can get a full traceback */ - moduleName = PyString_FromString("traceback"); + moduleName = PyUnicode_FromString("traceback"); pythonModule = PyImport_Import(moduleName); Py_DECREF(moduleName); From db8b0b5d80dd85f682935f2aea2a64a56fbbc0ea Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 8 Aug 2026 23:25:13 +0200 Subject: [PATCH 5/6] python: replace PyString_* with PyBytes_* The former existed for python 2.x, but are gone with pythong 3.x. To date it worked as swig did ship compatibility macros, but these are gone with swig 4.5.x. https://github.com/swig/swig/commit/79f7a2b7cb7ddc256eba09c8770133148025171d --- library/forms/swig/cairo.i | 9 ++++----- library/forms/swig/mforms.i | 18 +++++++++--------- library/forms/swig/mforms_drawbox.h | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/library/forms/swig/cairo.i b/library/forms/swig/cairo.i index 1602b3f29..5fc35e93b 100644 --- a/library/forms/swig/cairo.i +++ b/library/forms/swig/cairo.i @@ -132,13 +132,13 @@ if (PyUnicode_Check($input)) { PyObject *tmp = PyUnicode_AsUTF8String($input); - s = PyString_AsString(tmp); + s = PyBytes_AsString(tmp); $1 = (char*)s.c_str(); Py_DECREF(tmp); } - else if (PyString_Check($input)) + else if (PyBytes_Check($input)) { - s = PyString_AsString($input); + s = PyBytes_AsString($input); $1 = (char*)s.c_str(); } else @@ -158,7 +158,7 @@ for (int c= PyList_Size($input), i= 0; i < c; i++) { PyObject *item = PyList_GetItem($input, i); - if (PyFloat_Check(item)) + if (PyFloat_Check(item)) $1[i] = PyFloat_AsDouble(item); else { @@ -182,4 +182,3 @@ cairo_surface_t *cairo_image_surface_create_from_png_stream(PyObject *reader) { return cairo_image_surface_create_from_png_stream(py_read_func, reader); } - diff --git a/library/forms/swig/mforms.i b/library/forms/swig/mforms.i index 1c786e9e3..eea65393b 100644 --- a/library/forms/swig/mforms.i +++ b/library/forms/swig/mforms.i @@ -606,11 +606,11 @@ inline boost::function pycall_void_entryaction_f if (PyUnicode_Check($input)) { PyObject *tmp = PyUnicode_AsUTF8String($input); - $1 = new std::string(PyString_AsString(tmp)); + $1 = new std::string(PyBytes_AsString(tmp)); Py_DECREF(tmp); } - else if (PyString_Check($input)) - $1 = new std::string(PyString_AsString($input)); + else if (PyBytes_Check($input)) + $1 = new std::string(PyBytes_AsString($input)); else { PyErr_SetString(PyExc_TypeError, "not a string"); @@ -635,11 +635,11 @@ inline boost::function pycall_void_entryaction_f if (PyUnicode_Check(item)) { PyObject *tmp = PyUnicode_AsUTF8String(item); - $1->push_back(PyString_AsString(tmp)); + $1->push_back(PyBytes_AsString(tmp)); Py_DECREF(tmp); } - else if (PyString_Check(item)) - $1->push_back(PyString_AsString(item)); + else if (PyBytes_Check(item)) + $1->push_back(PyBytes_AsString(item)); else { delete $1; @@ -698,11 +698,11 @@ inline boost::function pycall_void_entryaction_f if (PyUnicode_Check(item)) { PyObject *tmp = PyUnicode_AsUTF8String(item); - $1->push_back(PyString_AsString(tmp)); + $1->push_back(PyBytes_AsString(tmp)); Py_DECREF(tmp); } - else if (PyString_Check(item)) - $1->push_back(PyString_AsString(item)); + else if (PyBytes_Check(item)) + $1->push_back(PyBytes_AsString(item)); else { delete $1; diff --git a/library/forms/swig/mforms_drawbox.h b/library/forms/swig/mforms_drawbox.h index e540c5454..eebfc83ab 100644 --- a/library/forms/swig/mforms_drawbox.h +++ b/library/forms/swig/mforms_drawbox.h @@ -164,7 +164,7 @@ namespace mforms { { PyObject *repr = PyObject_Repr(self); printf("Error calling method %s from PyDrawBox delegate %s\n", method, - PyString_AsString(repr)); + PyBytes_AsString(repr)); Py_DECREF(repr); }*/ } From 68f316075c57e1803459bd7ce90af2a491cb2c97 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 8 Aug 2026 23:25:50 +0200 Subject: [PATCH 6/6] grt: update for C++20 --- library/grt/src/grt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/grt/src/grt.h b/library/grt/src/grt.h index bc5e35212..c0fd68f6a 100644 --- a/library/grt/src/grt.h +++ b/library/grt/src/grt.h @@ -1385,7 +1385,7 @@ namespace grt { } protected: - explicit ListRef(const ValueRef &lvalue) : BaseListRef(lvalue) { + explicit ListRef(const ValueRef &lvalue) : BaseListRef(lvalue) { if (lvalue.is_valid() && content().content_type() != IntegerType) throw type_error(IntegerType, content().content_type(), ListType); } @@ -1813,7 +1813,7 @@ namespace grt { } protected: - explicit ListRef(const ValueRef &lvalue) : BaseListRef(lvalue) { + explicit ListRef(const ValueRef &lvalue) : BaseListRef(lvalue) { if (lvalue.is_valid() && content().content_type() != DictType) throw type_error(DictType, content().content_type(), ListType); }