From 2f97bd3f0cb8ac232c4cae376f2ff74302a20850 Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Tue, 27 Feb 2024 18:16:53 +0100 Subject: [PATCH 01/23] Rebuilt for java-21-openjdk as system jdk https://fedoraproject.org/wiki/Changes/Java21 --- swig.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swig.spec b/swig.spec index c7e3b43..660c9ec 100644 --- a/swig.spec +++ b/swig.spec @@ -58,7 +58,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.2.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -352,6 +352,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Tue Feb 27 2024 Jiri Vanek - 4.2.1-2 +- Rebuilt for java-21-openjdk as system jdk + * Mon Feb 26 2024 Jitka Plesnikova - 4.2.1-1 - 4.2.1 bump (rhbz#2265786) From daa3574f6d6ef859d20affe50e9e461a9e750674 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Thu, 7 Mar 2024 17:10:07 +0100 Subject: [PATCH 02/23] Temporary disable java tests (rhbz#2266693) --- ...ng-deprecated-API-in-doxygen-example.patch | 29 +++++ ...stem.runFinalization-removal-warning.patch | 118 ++++++++++++++++++ swig.spec | 8 +- 3 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch create mode 100644 swig-java-Suppress-System.runFinalization-removal-warning.patch diff --git a/swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch b/swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch new file mode 100644 index 0000000..44f449e --- /dev/null +++ b/swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch @@ -0,0 +1,29 @@ +From 8a19cb77adfec168236e2c63d1a9d1a310f886cc Mon Sep 17 00:00:00 2001 +From: Olly Betts +Date: Fri, 1 Mar 2024 10:40:12 +1300 +Subject: [PATCH] [java] Avoid using deprecated API in doxygen example + +Passing a String command to Runtime.exec() has been deprecated since +Java 18. +--- + Examples/java/doxygen/runme.java | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Examples/java/doxygen/runme.java b/Examples/java/doxygen/runme.java +index 6b7bb3d01..5970521c8 100644 +--- a/Examples/java/doxygen/runme.java ++++ b/Examples/java/doxygen/runme.java +@@ -33,8 +33,8 @@ public class runme { + System.out.println(" perimeter = " + shapes[i].perimeter()); + } + +- String command = "javadoc -quiet -public -d javadocs example.java Shape.java Circle.java Square.java RectangleInt.java"; +- System.out.println("\nRunning: " + command); ++ String[] command = {"javadoc", "-quiet", "-public", "-d", "javadocs", "example.java", "Shape.java", "Circle.java", "Square.java", "RectangleInt.java"}; ++ System.out.println("\nRunning: " + String.join(" ", command)); + Process p = Runtime.getRuntime().exec(command); + int exitCode = p.waitFor(); + System.out.println("javadoc exited with code " + exitCode); +-- +2.44.0 + diff --git a/swig-java-Suppress-System.runFinalization-removal-warning.patch b/swig-java-Suppress-System.runFinalization-removal-warning.patch new file mode 100644 index 0000000..2ad135d --- /dev/null +++ b/swig-java-Suppress-System.runFinalization-removal-warning.patch @@ -0,0 +1,118 @@ +From ec56bff28d3ad5acf82e139a83da8135aa2dd618 Mon Sep 17 00:00:00 2001 +From: Olly Betts +Date: Fri, 1 Mar 2024 10:42:22 +1300 +Subject: [PATCH] [java] Suppress System.runFinalization() removal warnings + +These need to be addressed, but meanwhile it makes running the testsuite +with OpenJDK 21 or newer unhelpfully noisy so suppressing it seems more +helpful than not. + +Closes: #2819 +--- + Examples/test-suite/java/cpp11_std_unique_ptr_runme.java | 2 ++ + Examples/test-suite/java/director_pass_by_value_runme.java | 2 ++ + Examples/test-suite/java/java_director_runme.java | 2 ++ + Examples/test-suite/java/li_boost_intrusive_ptr_runme.java | 4 ++++ + Examples/test-suite/java/li_boost_shared_ptr_runme.java | 4 ++++ + Examples/test-suite/java/li_std_auto_ptr_runme.java | 2 ++ + 6 files changed, 16 insertions(+) + +diff --git a/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java b/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java +index f90ef7041..c5622f65f 100644 +--- a/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java ++++ b/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java +@@ -10,6 +10,8 @@ public class cpp11_std_unique_ptr_runme { + } + } + ++ // Suppress warning about System.runFinalization() call. ++ @SuppressWarnings({"deprecation", "removal"}) + private static void WaitForGC() + { + System.gc(); +diff --git a/Examples/test-suite/java/director_pass_by_value_runme.java b/Examples/test-suite/java/director_pass_by_value_runme.java +index 1d34c3b55..48ccabf73 100644 +--- a/Examples/test-suite/java/director_pass_by_value_runme.java ++++ b/Examples/test-suite/java/director_pass_by_value_runme.java +@@ -12,6 +12,8 @@ public class director_pass_by_value_runme { + } + } + ++ // Suppress warning about System.runFinalization() call. ++ @SuppressWarnings({"deprecation", "removal"}) + private static void WaitForGC() { + System.gc(); + System.runFinalization(); +diff --git a/Examples/test-suite/java/java_director_runme.java b/Examples/test-suite/java/java_director_runme.java +index 2167d2621..40829463b 100644 +--- a/Examples/test-suite/java/java_director_runme.java ++++ b/Examples/test-suite/java/java_director_runme.java +@@ -13,6 +13,8 @@ public class java_director_runme { + } + } + ++ // Suppress warning about System.runFinalization() call. ++ @SuppressWarnings({"deprecation", "removal"}) + private static void WaitForGC() + { + System.gc(); +diff --git a/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java b/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java +index 750ec5067..721a78d56 100644 +--- a/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java ++++ b/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java +@@ -13,6 +13,8 @@ public class li_boost_intrusive_ptr_runme { + // Debugging flag + public final static boolean debug = false; + ++ // Suppress warning about System.runFinalization() call. ++ @SuppressWarnings({"deprecation", "removal"}) + private static void WaitForGC() + { + System.gc(); +@@ -23,6 +25,8 @@ public class li_boost_intrusive_ptr_runme { + } + } + ++ // Suppress warning about System.runFinalization() call. ++ @SuppressWarnings({"deprecation", "removal"}) + public static void main(String argv[]) + { + if (debug) +diff --git a/Examples/test-suite/java/li_boost_shared_ptr_runme.java b/Examples/test-suite/java/li_boost_shared_ptr_runme.java +index b513fade7..c1ec7f7bf 100644 +--- a/Examples/test-suite/java/li_boost_shared_ptr_runme.java ++++ b/Examples/test-suite/java/li_boost_shared_ptr_runme.java +@@ -13,6 +13,8 @@ public class li_boost_shared_ptr_runme { + // Debugging flag + public final static boolean debug = false; + ++ // Suppress warning about System.runFinalization() call. ++ @SuppressWarnings({"deprecation", "removal"}) + private static void WaitForGC() + { + System.gc(); +@@ -23,6 +25,8 @@ public class li_boost_shared_ptr_runme { + } + } + ++ // Suppress warning about System.runFinalization() call. ++ @SuppressWarnings({"deprecation", "removal"}) + public static void main(String argv[]) + { + if (debug) +diff --git a/Examples/test-suite/java/li_std_auto_ptr_runme.java b/Examples/test-suite/java/li_std_auto_ptr_runme.java +index 24e353ddc..978a72504 100644 +--- a/Examples/test-suite/java/li_std_auto_ptr_runme.java ++++ b/Examples/test-suite/java/li_std_auto_ptr_runme.java +@@ -10,6 +10,8 @@ public class li_std_auto_ptr_runme { + } + } + ++ // Suppress warning about System.runFinalization() call. ++ @SuppressWarnings({"deprecation", "removal"}) + private static void WaitForGC() + { + System.gc(); +-- +2.44.0 + diff --git a/swig.spec b/swig.spec index 660c9ec..85bca2f 100644 --- a/swig.spec +++ b/swig.spec @@ -45,7 +45,9 @@ %ifarch i686 %{!?javalang:%global javalang 0} %else -%{!?javalang:%global javalang 1} +# Temporary disable java tests, because they doesn't pass with java-21-openjdk +# https://github.com/swig/swig/issues/2767 +%{!?javalang:%global javalang 0} %endif # Do not run Go tests, they failed with 4.0.0 on ppc64le, s390 @@ -69,6 +71,9 @@ Source2: description-ccache.h2m Source3: ccache-swig.sh Source4: ccache-swig.csh %endif +# Small fixes for java tests, in upstream after 4.2.1 +Patch0: swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch +Patch1: swig-java-Suppress-System.runFinalization-removal-warning.patch BuildRequires: coreutils BuildRequires: findutils @@ -354,6 +359,7 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %changelog * Tue Feb 27 2024 Jiri Vanek - 4.2.1-2 - Rebuilt for java-21-openjdk as system jdk +- Temporary disable java tests (rhbz#2266693) * Mon Feb 26 2024 Jitka Plesnikova - 4.2.1-1 - 4.2.1 bump (rhbz#2265786) From abae643ad327aee0fb1e0d3ef458e6829258c42f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 12 Apr 2024 09:57:42 +0200 Subject: [PATCH 03/23] disable PHP support on 32-bit --- swig.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/swig.spec b/swig.spec index 85bca2f..78786dc 100644 --- a/swig.spec +++ b/swig.spec @@ -16,6 +16,12 @@ %global ocamllang 0 %endif +%if 0%{?fedora} >= 41 +%ifarch %{ix86} +%global phplang 0 +%endif +%endif + %{!?tcl:%global tcl 1} %{!?lualang:%global lualang 1} %{!?perllang:%global perllang 1} @@ -60,7 +66,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.2.1 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -357,6 +363,10 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Fri Apr 12 2024 Remi Collet - 4.2.1-3 +- disable PHP support on 32-bit + https://fedoraproject.org/wiki/Changes/php_no_32_bit + * Tue Feb 27 2024 Jiri Vanek - 4.2.1-2 - Rebuilt for java-21-openjdk as system jdk - Temporary disable java tests (rhbz#2266693) From 07e662f6d6d4fff2a7a4c1b91db6d97f18917111 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Tue, 16 Apr 2024 17:02:40 +0200 Subject: [PATCH 04/23] Disable PHP support on 32-bit --- swig.spec | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/swig.spec b/swig.spec index 78786dc..06112d3 100644 --- a/swig.spec +++ b/swig.spec @@ -16,18 +16,20 @@ %global ocamllang 0 %endif +%{!?tcl:%global tcl 1} +%{!?lualang:%global lualang 1} +%{!?perllang:%global perllang 1} +%{!?rubylang:%global rubylang 1} +%{!?python3lang:%global python3lang 1} + +# PHP drop support for 32-bit builds since Fedora 41. %if 0%{?fedora} >= 41 %ifarch %{ix86} %global phplang 0 %endif %endif - -%{!?tcl:%global tcl 1} -%{!?lualang:%global lualang 1} -%{!?perllang:%global perllang 1} %{!?phplang:%global phplang 1} -%{!?rubylang:%global rubylang 1} -%{!?python3lang:%global python3lang 1} + # OCaml packages not built on i686 since OCaml 5 / Fedora 39. %ifarch %{ix86} %{!?ocamllang:%global ocamllang 0} @@ -48,7 +50,7 @@ %bcond_without build_ccache_swig %endif -%ifarch i686 +%ifarch %{ix86} %{!?javalang:%global javalang 0} %else # Temporary disable java tests, because they doesn't pass with java-21-openjdk From 797df90a0b908a6aba5c96dcba741c81bb51379f Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Mon, 29 Apr 2024 16:41:21 +0200 Subject: [PATCH 05/23] Fix gcc -Wformat-security warning in R Raise function (rhbz#2277767) --- ...t-security-warning-in-R-Raise-functi.patch | 27 +++++++++++++++++++ swig.spec | 8 +++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch diff --git a/swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch b/swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch new file mode 100644 index 0000000..0c0cd61 --- /dev/null +++ b/swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch @@ -0,0 +1,27 @@ +From 3d5157514889c668bc14c245246c388eb23615ea Mon Sep 17 00:00:00 2001 +From: pekkarr +Date: Mon, 29 Apr 2024 10:00:38 +0300 +Subject: [PATCH] Fix gcc's -Wformat-security warning in R Raise function + (#2896) + +The `Rf_error` function takes a format string as its first argument. +--- + Lib/r/r.swg | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Lib/r/r.swg b/Lib/r/r.swg +index c1ce37c3e..63b69d8cf 100644 +--- a/Lib/r/r.swg ++++ b/Lib/r/r.swg +@@ -28,7 +28,7 @@ SWIGEXPORT void SWIG_init(void) { + + %runtime %{ + SWIGINTERN void SWIG_R_Raise(SEXP obj, const char *msg) { +- Rf_error(Rf_isString(obj) ? CHAR(Rf_asChar(obj)) : msg); ++ Rf_error("%s", Rf_isString(obj) ? CHAR(Rf_asChar(obj)) : msg); + } + %} + +-- +2.44.0 + diff --git a/swig.spec b/swig.spec index 06112d3..f8928e5 100644 --- a/swig.spec +++ b/swig.spec @@ -68,7 +68,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.2.1 -Release: 3%{?dist} +Release: 4%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -82,6 +82,9 @@ Source4: ccache-swig.csh # Small fixes for java tests, in upstream after 4.2.1 Patch0: swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch Patch1: swig-java-Suppress-System.runFinalization-removal-warning.patch +# Fix gcc's -Wformat-security warning in R Raise function +# https://github.com/swig/swig/pull/2896 +Patch2: swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch BuildRequires: coreutils BuildRequires: findutils @@ -365,6 +368,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Mon Apr 29 2024 Jitka Plesnikova - 4.2.1-4 +- Fix gcc's -Wformat-security warning in R Raise function (rhbz#2277767) + * Fri Apr 12 2024 Remi Collet - 4.2.1-3 - disable PHP support on 32-bit https://fedoraproject.org/wiki/Changes/php_no_32_bit From 7c322c4f697ec6da856698d7d4250b94d0d4607d Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 3 May 2024 18:28:12 -0400 Subject: [PATCH 06/23] Disable PHP support on 32-bit also in ELN --- swig.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swig.spec b/swig.spec index f8928e5..56aaa9e 100644 --- a/swig.spec +++ b/swig.spec @@ -23,7 +23,7 @@ %{!?python3lang:%global python3lang 1} # PHP drop support for 32-bit builds since Fedora 41. -%if 0%{?fedora} >= 41 +%if 0%{?fedora} >= 41 || 0%{?rhel} >= 11 %ifarch %{ix86} %global phplang 0 %endif From eb7c0ebce6cc9862bed3a791952c2149e34cbfb4 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 29 May 2024 17:43:44 +0100 Subject: [PATCH 07/23] OCaml 5.2.0 for Fedora 41 --- swig.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swig.spec b/swig.spec index 56aaa9e..cad6b50 100644 --- a/swig.spec +++ b/swig.spec @@ -68,7 +68,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.2.1 -Release: 4%{?dist} +Release: 5%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -368,6 +368,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Wed May 29 2024 Richard W.M. Jones - 4.2.1-5 +- OCaml 5.2.0 for Fedora 41 + * Mon Apr 29 2024 Jitka Plesnikova - 4.2.1-4 - Fix gcc's -Wformat-security warning in R Raise function (rhbz#2277767) From 7c0f355005386425b5c14f0a170b991fa2ee285a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 19 Jun 2024 11:56:21 +0100 Subject: [PATCH 08/23] OCaml 5.2.0 ppc64le fix --- swig.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swig.spec b/swig.spec index cad6b50..8d358e1 100644 --- a/swig.spec +++ b/swig.spec @@ -68,7 +68,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.2.1 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -368,6 +368,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Wed Jun 19 2024 Richard W.M. Jones - 4.2.1-6 +- OCaml 5.2.0 ppc64le fix + * Wed May 29 2024 Richard W.M. Jones - 4.2.1-5 - OCaml 5.2.0 for Fedora 41 From b2f85aac6451a440422f6ca46fb2bb05ff84af01 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 23 Jun 2024 18:10:24 -0400 Subject: [PATCH 09/23] Rebuild for Python 3.13 Requires upstream commits from https://github.com/swig/swig/pull/2925 --- ...3.13-deprecates-PyWeakref_GET_OBJECT.patch | 27 +++++++++++++++ ...-Python-3.13-strips-docstring-indent.patch | 34 +++++++++++++++++++ swig.spec | 8 ++++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch create mode 100644 swig-python-Python-3.13-strips-docstring-indent.patch diff --git a/swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch b/swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch new file mode 100644 index 0000000..268f55d --- /dev/null +++ b/swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch @@ -0,0 +1,27 @@ +From 7f0f267630386c41fbf44a0f6115d2555ba82451 Mon Sep 17 00:00:00 2001 +From: Julien Schueller +Date: Thu, 13 Jun 2024 15:32:46 +0200 +Subject: [PATCH] Python 3.13 deprecates PyWeakref_GET_OBJECT + +Closes #2863 +--- + Lib/python/pyrun.swg | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg +index 8381f16d27f..f7305eff108 100644 +--- a/Lib/python/pyrun.swg ++++ b/Lib/python/pyrun.swg +@@ -1343,7 +1343,12 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) + (void)obj; + # ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { ++#if PY_VERSION_HEX >= 0x030D0000 ++ PyWeakref_GetRef(pyobj, &pyobj); ++ Py_DECREF(pyobj); ++#else + pyobj = PyWeakref_GET_OBJECT(pyobj); ++#endif + if (pyobj && SwigPyObject_Check(pyobj)) + return (SwigPyObject*) pyobj; + } diff --git a/swig-python-Python-3.13-strips-docstring-indent.patch b/swig-python-Python-3.13-strips-docstring-indent.patch new file mode 100644 index 0000000..d0fce06 --- /dev/null +++ b/swig-python-Python-3.13-strips-docstring-indent.patch @@ -0,0 +1,34 @@ +From ffa856c8dc1fa97e6896a2c5d5bd647c15df2284 Mon Sep 17 00:00:00 2001 +From: Julien Schueller +Date: Thu, 13 Jun 2024 15:31:26 +0200 +Subject: [PATCH] Python 3.13 strips docstring indent + +--- + Examples/test-suite/python/python_docstring_runme.py | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/Examples/test-suite/python/python_docstring_runme.py b/Examples/test-suite/python/python_docstring_runme.py +index a601ecb5430..101f9dd8a30 100644 +--- a/Examples/test-suite/python/python_docstring_runme.py ++++ b/Examples/test-suite/python/python_docstring_runme.py +@@ -1,5 +1,6 @@ + from python_docstring import * + import inspect ++import sys + + def check(got, expected): + expected_list = expected.split("\n") +@@ -87,9 +88,10 @@ def check(got, expected): + ) + + # One line doc special case, use __doc__ +-check(DocStrings.docstringX.__doc__, +- " one line docs" +- ) ++if sys.version_info[0:2] < (3, 13): ++ check(DocStrings.docstringX.__doc__, " one line docs") ++else: ++ check(DocStrings.docstringX.__doc__, "one line docs") + + check(inspect.getdoc(DocStrings.docstringX), + "one line docs" diff --git a/swig.spec b/swig.spec index 8d358e1..6f03ec7 100644 --- a/swig.spec +++ b/swig.spec @@ -68,7 +68,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.2.1 -Release: 6%{?dist} +Release: 7%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -85,6 +85,9 @@ Patch1: swig-java-Suppress-System.runFinalization-removal-warning.patch # Fix gcc's -Wformat-security warning in R Raise function # https://github.com/swig/swig/pull/2896 Patch2: swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch +# Python 3.13 support: https://github.com/swig/swig/pull/2925 +Patch3: swig-python-Python-3.13-strips-docstring-indent.patch +Patch4: swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch BuildRequires: coreutils BuildRequires: findutils @@ -368,6 +371,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Sun Jun 23 2024 Yaakov Selkowitz - 4.2.1-7 +- Rebuild for Python 3.13 + * Wed Jun 19 2024 Richard W.M. Jones - 4.2.1-6 - OCaml 5.2.0 ppc64le fix From b7692274859a6fd653444b74fee2d33f102f135b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 20 Jul 2024 06:50:39 +0000 Subject: [PATCH 10/23] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- swig.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swig.spec b/swig.spec index 6f03ec7..a8eb803 100644 --- a/swig.spec +++ b/swig.spec @@ -68,7 +68,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.2.1 -Release: 7%{?dist} +Release: 8%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -371,6 +371,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Sat Jul 20 2024 Fedora Release Engineering - 4.2.1-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Sun Jun 23 2024 Yaakov Selkowitz - 4.2.1-7 - Rebuild for Python 3.13 From 967cd34363b439751e33e33f361369346656a428 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Mon, 21 Oct 2024 16:23:11 +0200 Subject: [PATCH 11/23] 4.3.0 bump (rhbz#2320047) --- .gitignore | 1 + sources | 2 +- ...t-security-warning-in-R-Raise-functi.patch | 27 ---- ...ng-deprecated-API-in-doxygen-example.patch | 29 ----- ...stem.runFinalization-removal-warning.patch | 118 ------------------ ...3.13-deprecates-PyWeakref_GET_OBJECT.patch | 27 ---- ...-Python-3.13-strips-docstring-indent.patch | 34 ----- swig.spec | 16 +-- 8 files changed, 7 insertions(+), 247 deletions(-) delete mode 100644 swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch delete mode 100644 swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch delete mode 100644 swig-java-Suppress-System.runFinalization-removal-warning.patch delete mode 100644 swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch delete mode 100644 swig-python-Python-3.13-strips-docstring-indent.patch diff --git a/.gitignore b/.gitignore index 3a819d9..7187454 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ swig-2.0.0.tar.gz /swig-4.1.1.tar.gz /swig-4.2.0.tar.gz /swig-4.2.1.tar.gz +/swig-4.3.0.tar.gz diff --git a/sources b/sources index e92004d..1a65880 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (swig-4.2.1.tar.gz) = 019dee5a46d57e1030eef47cd5d007ccaadbdcd4e53cd30d7c795f0118ecf4406a78185534502c81c5f6d7bac0713256e7e19b20b5a2d14e2c552219edbaf5cf +SHA512 (swig-4.3.0.tar.gz) = 5dfb8aa9898fccb063dbdf5d6266928cf46d671491308d2c122c59414377f1558015a37d7268729f62c5d4ee20438c98c83ee575fb00078dfe77564ee46a2f64 diff --git a/swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch b/swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch deleted file mode 100644 index 0c0cd61..0000000 --- a/swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 3d5157514889c668bc14c245246c388eb23615ea Mon Sep 17 00:00:00 2001 -From: pekkarr -Date: Mon, 29 Apr 2024 10:00:38 +0300 -Subject: [PATCH] Fix gcc's -Wformat-security warning in R Raise function - (#2896) - -The `Rf_error` function takes a format string as its first argument. ---- - Lib/r/r.swg | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Lib/r/r.swg b/Lib/r/r.swg -index c1ce37c3e..63b69d8cf 100644 ---- a/Lib/r/r.swg -+++ b/Lib/r/r.swg -@@ -28,7 +28,7 @@ SWIGEXPORT void SWIG_init(void) { - - %runtime %{ - SWIGINTERN void SWIG_R_Raise(SEXP obj, const char *msg) { -- Rf_error(Rf_isString(obj) ? CHAR(Rf_asChar(obj)) : msg); -+ Rf_error("%s", Rf_isString(obj) ? CHAR(Rf_asChar(obj)) : msg); - } - %} - --- -2.44.0 - diff --git a/swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch b/swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch deleted file mode 100644 index 44f449e..0000000 --- a/swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8a19cb77adfec168236e2c63d1a9d1a310f886cc Mon Sep 17 00:00:00 2001 -From: Olly Betts -Date: Fri, 1 Mar 2024 10:40:12 +1300 -Subject: [PATCH] [java] Avoid using deprecated API in doxygen example - -Passing a String command to Runtime.exec() has been deprecated since -Java 18. ---- - Examples/java/doxygen/runme.java | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Examples/java/doxygen/runme.java b/Examples/java/doxygen/runme.java -index 6b7bb3d01..5970521c8 100644 ---- a/Examples/java/doxygen/runme.java -+++ b/Examples/java/doxygen/runme.java -@@ -33,8 +33,8 @@ public class runme { - System.out.println(" perimeter = " + shapes[i].perimeter()); - } - -- String command = "javadoc -quiet -public -d javadocs example.java Shape.java Circle.java Square.java RectangleInt.java"; -- System.out.println("\nRunning: " + command); -+ String[] command = {"javadoc", "-quiet", "-public", "-d", "javadocs", "example.java", "Shape.java", "Circle.java", "Square.java", "RectangleInt.java"}; -+ System.out.println("\nRunning: " + String.join(" ", command)); - Process p = Runtime.getRuntime().exec(command); - int exitCode = p.waitFor(); - System.out.println("javadoc exited with code " + exitCode); --- -2.44.0 - diff --git a/swig-java-Suppress-System.runFinalization-removal-warning.patch b/swig-java-Suppress-System.runFinalization-removal-warning.patch deleted file mode 100644 index 2ad135d..0000000 --- a/swig-java-Suppress-System.runFinalization-removal-warning.patch +++ /dev/null @@ -1,118 +0,0 @@ -From ec56bff28d3ad5acf82e139a83da8135aa2dd618 Mon Sep 17 00:00:00 2001 -From: Olly Betts -Date: Fri, 1 Mar 2024 10:42:22 +1300 -Subject: [PATCH] [java] Suppress System.runFinalization() removal warnings - -These need to be addressed, but meanwhile it makes running the testsuite -with OpenJDK 21 or newer unhelpfully noisy so suppressing it seems more -helpful than not. - -Closes: #2819 ---- - Examples/test-suite/java/cpp11_std_unique_ptr_runme.java | 2 ++ - Examples/test-suite/java/director_pass_by_value_runme.java | 2 ++ - Examples/test-suite/java/java_director_runme.java | 2 ++ - Examples/test-suite/java/li_boost_intrusive_ptr_runme.java | 4 ++++ - Examples/test-suite/java/li_boost_shared_ptr_runme.java | 4 ++++ - Examples/test-suite/java/li_std_auto_ptr_runme.java | 2 ++ - 6 files changed, 16 insertions(+) - -diff --git a/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java b/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java -index f90ef7041..c5622f65f 100644 ---- a/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java -+++ b/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java -@@ -10,6 +10,8 @@ public class cpp11_std_unique_ptr_runme { - } - } - -+ // Suppress warning about System.runFinalization() call. -+ @SuppressWarnings({"deprecation", "removal"}) - private static void WaitForGC() - { - System.gc(); -diff --git a/Examples/test-suite/java/director_pass_by_value_runme.java b/Examples/test-suite/java/director_pass_by_value_runme.java -index 1d34c3b55..48ccabf73 100644 ---- a/Examples/test-suite/java/director_pass_by_value_runme.java -+++ b/Examples/test-suite/java/director_pass_by_value_runme.java -@@ -12,6 +12,8 @@ public class director_pass_by_value_runme { - } - } - -+ // Suppress warning about System.runFinalization() call. -+ @SuppressWarnings({"deprecation", "removal"}) - private static void WaitForGC() { - System.gc(); - System.runFinalization(); -diff --git a/Examples/test-suite/java/java_director_runme.java b/Examples/test-suite/java/java_director_runme.java -index 2167d2621..40829463b 100644 ---- a/Examples/test-suite/java/java_director_runme.java -+++ b/Examples/test-suite/java/java_director_runme.java -@@ -13,6 +13,8 @@ public class java_director_runme { - } - } - -+ // Suppress warning about System.runFinalization() call. -+ @SuppressWarnings({"deprecation", "removal"}) - private static void WaitForGC() - { - System.gc(); -diff --git a/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java b/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java -index 750ec5067..721a78d56 100644 ---- a/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java -+++ b/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java -@@ -13,6 +13,8 @@ public class li_boost_intrusive_ptr_runme { - // Debugging flag - public final static boolean debug = false; - -+ // Suppress warning about System.runFinalization() call. -+ @SuppressWarnings({"deprecation", "removal"}) - private static void WaitForGC() - { - System.gc(); -@@ -23,6 +25,8 @@ public class li_boost_intrusive_ptr_runme { - } - } - -+ // Suppress warning about System.runFinalization() call. -+ @SuppressWarnings({"deprecation", "removal"}) - public static void main(String argv[]) - { - if (debug) -diff --git a/Examples/test-suite/java/li_boost_shared_ptr_runme.java b/Examples/test-suite/java/li_boost_shared_ptr_runme.java -index b513fade7..c1ec7f7bf 100644 ---- a/Examples/test-suite/java/li_boost_shared_ptr_runme.java -+++ b/Examples/test-suite/java/li_boost_shared_ptr_runme.java -@@ -13,6 +13,8 @@ public class li_boost_shared_ptr_runme { - // Debugging flag - public final static boolean debug = false; - -+ // Suppress warning about System.runFinalization() call. -+ @SuppressWarnings({"deprecation", "removal"}) - private static void WaitForGC() - { - System.gc(); -@@ -23,6 +25,8 @@ public class li_boost_shared_ptr_runme { - } - } - -+ // Suppress warning about System.runFinalization() call. -+ @SuppressWarnings({"deprecation", "removal"}) - public static void main(String argv[]) - { - if (debug) -diff --git a/Examples/test-suite/java/li_std_auto_ptr_runme.java b/Examples/test-suite/java/li_std_auto_ptr_runme.java -index 24e353ddc..978a72504 100644 ---- a/Examples/test-suite/java/li_std_auto_ptr_runme.java -+++ b/Examples/test-suite/java/li_std_auto_ptr_runme.java -@@ -10,6 +10,8 @@ public class li_std_auto_ptr_runme { - } - } - -+ // Suppress warning about System.runFinalization() call. -+ @SuppressWarnings({"deprecation", "removal"}) - private static void WaitForGC() - { - System.gc(); --- -2.44.0 - diff --git a/swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch b/swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch deleted file mode 100644 index 268f55d..0000000 --- a/swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7f0f267630386c41fbf44a0f6115d2555ba82451 Mon Sep 17 00:00:00 2001 -From: Julien Schueller -Date: Thu, 13 Jun 2024 15:32:46 +0200 -Subject: [PATCH] Python 3.13 deprecates PyWeakref_GET_OBJECT - -Closes #2863 ---- - Lib/python/pyrun.swg | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg -index 8381f16d27f..f7305eff108 100644 ---- a/Lib/python/pyrun.swg -+++ b/Lib/python/pyrun.swg -@@ -1343,7 +1343,12 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) - (void)obj; - # ifdef PyWeakref_CheckProxy - if (PyWeakref_CheckProxy(pyobj)) { -+#if PY_VERSION_HEX >= 0x030D0000 -+ PyWeakref_GetRef(pyobj, &pyobj); -+ Py_DECREF(pyobj); -+#else - pyobj = PyWeakref_GET_OBJECT(pyobj); -+#endif - if (pyobj && SwigPyObject_Check(pyobj)) - return (SwigPyObject*) pyobj; - } diff --git a/swig-python-Python-3.13-strips-docstring-indent.patch b/swig-python-Python-3.13-strips-docstring-indent.patch deleted file mode 100644 index d0fce06..0000000 --- a/swig-python-Python-3.13-strips-docstring-indent.patch +++ /dev/null @@ -1,34 +0,0 @@ -From ffa856c8dc1fa97e6896a2c5d5bd647c15df2284 Mon Sep 17 00:00:00 2001 -From: Julien Schueller -Date: Thu, 13 Jun 2024 15:31:26 +0200 -Subject: [PATCH] Python 3.13 strips docstring indent - ---- - Examples/test-suite/python/python_docstring_runme.py | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/Examples/test-suite/python/python_docstring_runme.py b/Examples/test-suite/python/python_docstring_runme.py -index a601ecb5430..101f9dd8a30 100644 ---- a/Examples/test-suite/python/python_docstring_runme.py -+++ b/Examples/test-suite/python/python_docstring_runme.py -@@ -1,5 +1,6 @@ - from python_docstring import * - import inspect -+import sys - - def check(got, expected): - expected_list = expected.split("\n") -@@ -87,9 +88,10 @@ def check(got, expected): - ) - - # One line doc special case, use __doc__ --check(DocStrings.docstringX.__doc__, -- " one line docs" -- ) -+if sys.version_info[0:2] < (3, 13): -+ check(DocStrings.docstringX.__doc__, " one line docs") -+else: -+ check(DocStrings.docstringX.__doc__, "one line docs") - - check(inspect.getdoc(DocStrings.docstringX), - "one line docs" diff --git a/swig.spec b/swig.spec index a8eb803..f9831fe 100644 --- a/swig.spec +++ b/swig.spec @@ -67,8 +67,8 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig -Version: 4.2.1 -Release: 8%{?dist} +Version: 4.3.0 +Release: 1%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -79,15 +79,6 @@ Source2: description-ccache.h2m Source3: ccache-swig.sh Source4: ccache-swig.csh %endif -# Small fixes for java tests, in upstream after 4.2.1 -Patch0: swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch -Patch1: swig-java-Suppress-System.runFinalization-removal-warning.patch -# Fix gcc's -Wformat-security warning in R Raise function -# https://github.com/swig/swig/pull/2896 -Patch2: swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch -# Python 3.13 support: https://github.com/swig/swig/pull/2925 -Patch3: swig-python-Python-3.13-strips-docstring-indent.patch -Patch4: swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch BuildRequires: coreutils BuildRequires: findutils @@ -371,6 +362,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Mon Oct 21 2024 Jitka Plesnikova - 4.3.0-1 +- 4.3.0 bump (rhbz#2320047) + * Sat Jul 20 2024 Fedora Release Engineering - 4.2.1-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From fc387ae5fee84d9e97ccc96b315533b73816c385 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Tue, 29 Oct 2024 10:17:11 +0100 Subject: [PATCH 12/23] Fix precedence of casts --- swig-4.3.0-Fix-precedence-of-casts.patch | 85 ++++++++++++++++++++++++ swig.spec | 8 ++- 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 swig-4.3.0-Fix-precedence-of-casts.patch diff --git a/swig-4.3.0-Fix-precedence-of-casts.patch b/swig-4.3.0-Fix-precedence-of-casts.patch new file mode 100644 index 0000000..71576d2 --- /dev/null +++ b/swig-4.3.0-Fix-precedence-of-casts.patch @@ -0,0 +1,85 @@ +From 4e315cdd7c9072fd33ac1df3d208a0990b8231c3 Mon Sep 17 00:00:00 2001 +From: Olly Betts +Date: Sun, 27 Oct 2024 10:02:11 +1300 +Subject: [PATCH] Fix precedence of casts + +Casts should have the same high precedence as unary plus and minus, but +actually had a lower precedence than anything else. + +This could lead to the wrong type being deduced in obscure cases, but +also prevented SWIG deducing a type for expressions such as (0)*1+2 +which SWIG parses as a cast and then fixes up afterwards. + +A bug fixed in 4.3.0 made this latter problem manifest more often +(previously type deduction happened to work for (0)*1+2 due to an +internal field not getting cleared properly). + +Fixes #3058 +--- + CHANGES.current | 11 +++++++++++ + Examples/test-suite/cpp11_auto_variable.i | 8 ++++++++ + Source/CParse/parser.y | 3 +-- + 3 files changed, 20 insertions(+), 2 deletions(-) + +#diff --git a/CHANGES.current b/CHANGES.current +#index 42a2be6e7..f173d84e6 100644 +#--- a/CHANGES.current +#+++ b/CHANGES.current +#@@ -7,6 +7,17 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ +# Version 4.4.0 (in progress) +# =========================== +# +#+2024-10-27: olly +#+ #3058 Fix precedence of casts, which should have the same high +#+ precedence as unary plus and minus, but actually had a lower +#+ precedence than anything else. This could lead to the wrong type +#+ being deduced in obscure cases, but also prevented SWIG deducing a +#+ type for expressions such as (0)*1+2 which SWIG parses as a cast +#+ and then fixes up afterwards. A bug fixed in 4.3.0 made this +#+ latter problem manifest more often (previously type deduction +#+ happened to work for (0)*1+2 due to an internal field not getting +#+ cleared properly). +#+ +# 2024-10-25: olly +# [Guile] Allow wrapping anything with a `varout` typemap as a +# constant. +diff --git a/Examples/test-suite/cpp11_auto_variable.i b/Examples/test-suite/cpp11_auto_variable.i +index 7345296b5..e0a14ccd9 100644 +--- a/Examples/test-suite/cpp11_auto_variable.i ++++ b/Examples/test-suite/cpp11_auto_variable.i +@@ -62,3 +62,11 @@ static auto wstring_lit_len2 = sizeof("123" L"456") / sizeof(wchar_t) - 1; + //static auto constexpr greeting = "Hello"; + + %} ++ ++%inline %{ ++/* Regression test for #3058 */ ++auto CAST_HAD_WRONG_PRECEDENCE1 = (0)*1+2; ++auto CAST_HAD_WRONG_PRECEDENCE2 = (0)&1|2; ++auto CAST_HAD_WRONG_PRECEDENCE3 = (0)-1|2; ++auto CAST_HAD_WRONG_PRECEDENCE4 = (0)+1|2; ++%} +diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y +index a229e2e70..f3ed4040a 100644 +--- a/Source/CParse/parser.y ++++ b/Source/CParse/parser.y +@@ -1793,7 +1793,6 @@ static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier) + %token DOXYGENSTRING + %token DOXYGENPOSTSTRING + +-%precedence CAST + %left QUESTIONMARK + %left LOR + %left LAND +@@ -1809,7 +1808,7 @@ static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier) + %left LSHIFT RSHIFT + %left PLUS MINUS + %left STAR SLASH MODULO +-%precedence UMINUS NOT LNOT ++%precedence UMINUS NOT LNOT CAST + %token DCOLON + + %type program interface declaration swig_directive ; +-- +2.47.0 + diff --git a/swig.spec b/swig.spec index f9831fe..6c21528 100644 --- a/swig.spec +++ b/swig.spec @@ -68,7 +68,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.3.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -79,6 +79,9 @@ Source2: description-ccache.h2m Source3: ccache-swig.sh Source4: ccache-swig.csh %endif +# Fix precedence of casts - in upstream after 4.3.0 +# https://github.com/swig/swig/issues/3058 +Patch1: swig-4.3.0-Fix-precedence-of-casts.patch BuildRequires: coreutils BuildRequires: findutils @@ -362,6 +365,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Tue Oct 29 2024 Jitka Plesnikova - 4.3.0-2 +- Fix precedence of casts + * Mon Oct 21 2024 Jitka Plesnikova - 4.3.0-1 - 4.3.0 bump (rhbz#2320047) From b2c552c89d153d6e79cbef32af3c69f34a00dd6e Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 13 Nov 2024 19:32:11 -0700 Subject: [PATCH 13/23] Rebuild for octave 9.2 --- swig.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swig.spec b/swig.spec index 6c21528..75e6a15 100644 --- a/swig.spec +++ b/swig.spec @@ -68,7 +68,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.3.0 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -365,6 +365,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Thu Nov 14 2024 Orion Poplawski - 4.3.0-3 +- Rebuild for octave 9.2 + * Tue Oct 29 2024 Jitka Plesnikova - 4.3.0-2 - Fix precedence of casts From 65e8c5a6c2f111ae5c42acf0cab2dd05b0a31baa Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 19 Jan 2025 12:06:28 +0000 Subject: [PATCH 14/23] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- swig.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swig.spec b/swig.spec index 75e6a15..fbfcb16 100644 --- a/swig.spec +++ b/swig.spec @@ -68,7 +68,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.3.0 -Release: 3%{?dist} +Release: 4%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -365,6 +365,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Sun Jan 19 2025 Fedora Release Engineering - 4.3.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Thu Nov 14 2024 Orion Poplawski - 4.3.0-3 - Rebuild for octave 9.2 From 6d8e3c92689366e220c66320ea499cdd93be05ed Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Mon, 17 Feb 2025 16:05:04 +0100 Subject: [PATCH 15/23] Disable R tests, because they need tcl < 9 --- swig.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/swig.spec b/swig.spec index fbfcb16..8b60215 100644 --- a/swig.spec +++ b/swig.spec @@ -46,7 +46,8 @@ %else %{!?guile:%global guile 1} %{!?octave:%global octave 1} -%{!?Rlang:%global Rlang 1} +# R-core requires tcl < 9.0.0 +%{!?Rlang:%global Rlang 0} %bcond_without build_ccache_swig %endif @@ -68,7 +69,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.3.0 -Release: 4%{?dist} +Release: 5%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -107,7 +108,7 @@ BuildRequires: boost-devel # Need when Source/CParse/parser.y is patched BuildRequires: bison %if %{tcl} -BuildRequires: tcl-devel +BuildRequires: tcl-devel >= 9.0.0 %endif %if %{guile} BuildRequires: guile-devel @@ -365,6 +366,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Mon Feb 17 2025 Jitka Plesnikova - 4.3.0-5 +- Disable R tests, because they need tcl < 9 + * Sun Jan 19 2025 Fedora Release Engineering - 4.3.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 79b2996e10a0d5cd6b39f377d99315087292f21e Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Wed, 16 Apr 2025 14:14:17 +0200 Subject: [PATCH 16/23] 4.3.1 bump (rhbz#2360009) --- .gitignore | 1 + sources | 2 +- swig-4.3.0-Fix-precedence-of-casts.patch | 85 ------------------------ swig.spec | 10 +-- 4 files changed, 7 insertions(+), 91 deletions(-) delete mode 100644 swig-4.3.0-Fix-precedence-of-casts.patch diff --git a/.gitignore b/.gitignore index 7187454..34ba3f1 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ swig-2.0.0.tar.gz /swig-4.2.0.tar.gz /swig-4.2.1.tar.gz /swig-4.3.0.tar.gz +/swig-4.3.1.tar.gz diff --git a/sources b/sources index 1a65880..581ec8f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (swig-4.3.0.tar.gz) = 5dfb8aa9898fccb063dbdf5d6266928cf46d671491308d2c122c59414377f1558015a37d7268729f62c5d4ee20438c98c83ee575fb00078dfe77564ee46a2f64 +SHA512 (swig-4.3.1.tar.gz) = 8958f7bc3345549a9bc4e00aa8d40a99f6c4bb92b95d627c8796cf8f8d1ba0041a89cab542f171778c2b26aa2a877767181ae9bd2c05fd055f373a32a463399c diff --git a/swig-4.3.0-Fix-precedence-of-casts.patch b/swig-4.3.0-Fix-precedence-of-casts.patch deleted file mode 100644 index 71576d2..0000000 --- a/swig-4.3.0-Fix-precedence-of-casts.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 4e315cdd7c9072fd33ac1df3d208a0990b8231c3 Mon Sep 17 00:00:00 2001 -From: Olly Betts -Date: Sun, 27 Oct 2024 10:02:11 +1300 -Subject: [PATCH] Fix precedence of casts - -Casts should have the same high precedence as unary plus and minus, but -actually had a lower precedence than anything else. - -This could lead to the wrong type being deduced in obscure cases, but -also prevented SWIG deducing a type for expressions such as (0)*1+2 -which SWIG parses as a cast and then fixes up afterwards. - -A bug fixed in 4.3.0 made this latter problem manifest more often -(previously type deduction happened to work for (0)*1+2 due to an -internal field not getting cleared properly). - -Fixes #3058 ---- - CHANGES.current | 11 +++++++++++ - Examples/test-suite/cpp11_auto_variable.i | 8 ++++++++ - Source/CParse/parser.y | 3 +-- - 3 files changed, 20 insertions(+), 2 deletions(-) - -#diff --git a/CHANGES.current b/CHANGES.current -#index 42a2be6e7..f173d84e6 100644 -#--- a/CHANGES.current -#+++ b/CHANGES.current -#@@ -7,6 +7,17 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ -# Version 4.4.0 (in progress) -# =========================== -# -#+2024-10-27: olly -#+ #3058 Fix precedence of casts, which should have the same high -#+ precedence as unary plus and minus, but actually had a lower -#+ precedence than anything else. This could lead to the wrong type -#+ being deduced in obscure cases, but also prevented SWIG deducing a -#+ type for expressions such as (0)*1+2 which SWIG parses as a cast -#+ and then fixes up afterwards. A bug fixed in 4.3.0 made this -#+ latter problem manifest more often (previously type deduction -#+ happened to work for (0)*1+2 due to an internal field not getting -#+ cleared properly). -#+ -# 2024-10-25: olly -# [Guile] Allow wrapping anything with a `varout` typemap as a -# constant. -diff --git a/Examples/test-suite/cpp11_auto_variable.i b/Examples/test-suite/cpp11_auto_variable.i -index 7345296b5..e0a14ccd9 100644 ---- a/Examples/test-suite/cpp11_auto_variable.i -+++ b/Examples/test-suite/cpp11_auto_variable.i -@@ -62,3 +62,11 @@ static auto wstring_lit_len2 = sizeof("123" L"456") / sizeof(wchar_t) - 1; - //static auto constexpr greeting = "Hello"; - - %} -+ -+%inline %{ -+/* Regression test for #3058 */ -+auto CAST_HAD_WRONG_PRECEDENCE1 = (0)*1+2; -+auto CAST_HAD_WRONG_PRECEDENCE2 = (0)&1|2; -+auto CAST_HAD_WRONG_PRECEDENCE3 = (0)-1|2; -+auto CAST_HAD_WRONG_PRECEDENCE4 = (0)+1|2; -+%} -diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y -index a229e2e70..f3ed4040a 100644 ---- a/Source/CParse/parser.y -+++ b/Source/CParse/parser.y -@@ -1793,7 +1793,6 @@ static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier) - %token DOXYGENSTRING - %token DOXYGENPOSTSTRING - --%precedence CAST - %left QUESTIONMARK - %left LOR - %left LAND -@@ -1809,7 +1808,7 @@ static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier) - %left LSHIFT RSHIFT - %left PLUS MINUS - %left STAR SLASH MODULO --%precedence UMINUS NOT LNOT -+%precedence UMINUS NOT LNOT CAST - %token DCOLON - - %type program interface declaration swig_directive ; --- -2.47.0 - diff --git a/swig.spec b/swig.spec index 8b60215..2e82a1c 100644 --- a/swig.spec +++ b/swig.spec @@ -68,8 +68,8 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig -Version: 4.3.0 -Release: 5%{?dist} +Version: 4.3.1 +Release: 1%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -80,9 +80,6 @@ Source2: description-ccache.h2m Source3: ccache-swig.sh Source4: ccache-swig.csh %endif -# Fix precedence of casts - in upstream after 4.3.0 -# https://github.com/swig/swig/issues/3058 -Patch1: swig-4.3.0-Fix-precedence-of-casts.patch BuildRequires: coreutils BuildRequires: findutils @@ -366,6 +363,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Wed Apr 16 2025 Jitka Plesnikova - 4.3.1-1 +- 4.3.1 bump (rhbz#2360009) + * Mon Feb 17 2025 Jitka Plesnikova - 4.3.0-5 - Disable R tests, because they need tcl < 9 From 7f3c4ff630f3e20a2012ddc85ace094b6ddac530 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 25 Jun 2025 18:36:40 -0400 Subject: [PATCH 17/23] Add Python 3.14 support https://github.com/swig/swig/pull/3159 --- swig-python-Python-3.14-support.patch | 153 ++++++++++++++++++++++++++ swig.spec | 7 +- 2 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 swig-python-Python-3.14-support.patch diff --git a/swig-python-Python-3.14-support.patch b/swig-python-Python-3.14-support.patch new file mode 100644 index 0000000..ceee305 --- /dev/null +++ b/swig-python-Python-3.14-support.patch @@ -0,0 +1,153 @@ +From 50e1cc8bc0d090164762ec166439f8b0f3855308 Mon Sep 17 00:00:00 2001 +From: Julien Schueller +Date: Thu, 10 Apr 2025 17:22:15 +0200 +Subject: [PATCH 1/3] Python: Handle __package__ removal + +Closes #2967 +--- + Doc/Manual/Python.html | 6 +++--- + Source/Modules/python.cxx | 8 +++++--- + 2 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html +index 23587e5dbcc..01fc449a68a 100644 +--- a/Doc/Manual/Python.html ++++ b/Doc/Manual/Python.html +@@ -6552,7 +6552,7 @@

33.11.6.1 Both modules + +

+ In this configuration, the pure Python module, foo.py, tries to load the C/C++ module, _foo, from the same package foo.py is +-located in. The package name is determined from the __package__ ++located in. The package name is determined from the __spec__.parent (or __package__ before Python 3.4) + attribute if available, see PEP 366. Otherwise it is derived from the __name__ + attribute given to foo.py by the Python loader that imported foo.py. + The interface file for this configuration would contain: +@@ -6675,7 +6675,7 @@

33.11.6.4 More on customizing the modu + +
+
+-if __package__ or '.' in __name__:
++if getattr(__spec__, "parent", None) or '.' in __name__:
+     from . import _foo
+ else:
+     import _foo
+@@ -6760,7 +6760,7 @@ 

33.11.6.4 More on customizing the modu + +
+
+-if __package__ or '.' in __name__:
++if getattr(__spec__, "parent", None) or '.' in __name__:
+     from ._foo import *
+ else:
+     from _foo import *
+diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
+index 86daf131c8b..a71fc3cdb25 100644
+--- a/Source/Modules/python.cxx
++++ b/Source/Modules/python.cxx
+@@ -703,20 +703,22 @@ class PYTHON:public Language {
+ 	 * onwards (implicit relative imports raised a DeprecationWarning in 2.6,
+ 	 * and fail in 2.7 onwards).
+ 	 *
+-	 * First check for __package__ which is available from 2.6 onwards, see PEP366.
++	 * First check for __spec__.parent which is available from 3.4 onwards,
++	 * see https://docs.python.org/3/reference/import.html#spec. If not,
++	 * check for __package__, which was set before 3.14.
+ 	 * Next try determine the shadow wrapper's package based on the __name__ it
+ 	 * was given by the importer that loaded it.
+ 	 * If the module is in a package, load the low-level C/C++ module from the
+ 	 * same package, otherwise load it as a global module.
+ 	 */
+         Printv(default_import_code, "# Import the low-level C/C++ module\n", NULL);
+-        Printv(default_import_code, "if __package__ or \".\" in __name__:\n", NULL);
++        Printv(default_import_code, "if getattr(globals().get(\"__spec__\"), \"parent\", None) or globals().get(\"__package__\") or \".\" in __name__:\n", NULL);
+         Printv(default_import_code, tab4, "from . import ", module, "\n", NULL);
+         Printv(default_import_code, "else:\n", NULL);
+         Printv(default_import_code, tab4, "import ", module, "\n", NULL);
+       } else {
+         Printv(default_import_code, "# Pull in all the attributes from the low-level C/C++ module\n", NULL);
+-        Printv(default_import_code, "if __package__ or \".\" in __name__:\n", NULL);
++        Printv(default_import_code, "if getattr(globals().get(\"__spec__\"), \"parent\", None) or globals().get(\"__package__\") or \".\" in __name__:\n", NULL);
+         Printv(default_import_code, tab4, "from .", module, " import *\n", NULL);
+         Printv(default_import_code, "else:\n", NULL);
+         Printv(default_import_code, tab4, "from ", module, " import *\n", NULL);
+
+From 3bfdf13c602f877860a9949ba751a5b5a9ba70aa Mon Sep 17 00:00:00 2001
+From: Julien Schueller 
+Date: Thu, 10 Apr 2025 18:35:25 +0200
+Subject: [PATCH 2/3] Python: Add ht_token
+
+---
+ Source/Modules/python.cxx | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
+index a71fc3cdb25..3070a94face 100644
+--- a/Source/Modules/python.cxx
++++ b/Source/Modules/python.cxx
+@@ -4374,6 +4374,11 @@ class PYTHON:public Language {
+     Printv(f, "#if PY_VERSION_HEX >= 0x030b0000\n", NIL);
+     printSlot(f, getSlot(n, "feature:python:_ht_tpname"), "_ht_tpname", "char *");
+ 
++    // void *ht_token;
++    Printv(f, "#if PY_VERSION_HEX >= 0x030e0000\n", NIL);
++    printSlot(f, getSlot(n, "feature:python:ht_token"), "ht_token", "void *");
++    Printv(f, "#endif\n", NIL);
++
+     // struct _specialization_cache _spec_cache;
+     Printf(f, "  {\n");
+     printSlot(f, getSlot(n, "feature:python:getitem"), "getitem", "PyObject *");
+
+From 55237efa7219f65a04e0ffc69a81c574b5f5e162 Mon Sep 17 00:00:00 2001
+From: Julien Schueller 
+Date: Thu, 10 Apr 2025 17:47:59 +0200
+Subject: [PATCH 3/3] Python: Amend annotations test
+
+---
+ .../python_annotations_variable_c_runme.py    | 24 +++++++++++++------
+ 1 file changed, 17 insertions(+), 7 deletions(-)
+
+diff --git a/Examples/test-suite/python/python_annotations_variable_c_runme.py b/Examples/test-suite/python/python_annotations_variable_c_runme.py
+index 153852d05e6..d1f359bbbd0 100644
+--- a/Examples/test-suite/python/python_annotations_variable_c_runme.py
++++ b/Examples/test-suite/python/python_annotations_variable_c_runme.py
+@@ -1,4 +1,17 @@
+ import sys
++import inspect
++
++
++def get_annotations(cls):
++    # Python >=3.14 removed the __annotations__ attribute
++    # retrieve it via inspect (see also annotationlib)
++    if hasattr(inspect, "get_annotations"):
++        # Python >=3.10
++        return inspect.get_annotations(cls)
++    else:
++        # Python <3.10
++        return getattr(cls, "__annotations__", {})
++
+ 
+ # Variable annotations for properties is only supported in python-3.6 and later (PEP 526)
+ if sys.version_info[0:2] >= (3, 6):
+@@ -8,17 +21,14 @@
+     annotations_supported = not(is_python_builtin() or is_python_fastproxy())
+ 
+     if annotations_supported:
+-        ts = TemplateShort()
+-        anno = ts.__annotations__
++        anno = get_annotations(TemplateShort)
+         if anno != {'member_variable': 'int'}:
+             raise RuntimeError("annotations mismatch: {}".format(anno))
+ 
+-        ts = StructWithVar()
+-        anno = ts.__annotations__
++        anno = get_annotations(StructWithVar)
+         if anno != {'member_variable': 'int'}:
+             raise RuntimeError("annotations mismatch: {}".format(anno))
+ 
+-        ts = StructWithVarNotAnnotated()
+-        if getattr(ts, "__annotations__", None) != None:
+-            anno = ts.__annotations__
++        anno = get_annotations(StructWithVarNotAnnotated)
++        if anno != {}:
+             raise RuntimeError("annotations mismatch: {}".format(anno))
+
diff --git a/swig.spec b/swig.spec
index 2e82a1c..52a6616 100644
--- a/swig.spec
+++ b/swig.spec
@@ -69,7 +69,7 @@
 Summary: Connects C/C++/Objective C to some high-level programming languages
 Name:    swig
 Version: 4.3.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPL-3.0-or-later AND BSD-3-Clause
 URL:     https://www.swig.org/
 Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
@@ -80,6 +80,8 @@ Source2: description-ccache.h2m
 Source3: ccache-swig.sh
 Source4: ccache-swig.csh
 %endif
+# https://github.com/swig/swig/pull/3159
+Patch0:  swig-python-Python-3.14-support.patch
 
 BuildRequires: coreutils
 BuildRequires: findutils
@@ -363,6 +365,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb
 %{_datadir}/%{name}/gdb
 
 %changelog
+* Wed Jun 25 2025 Yaakov Selkowitz  - 4.3.1-2
+- Add Python 3.14 support
+
 * Wed Apr 16 2025 Jitka Plesnikova  - 4.3.1-1
 - 4.3.1 bump (rhbz#2360009)
 

From 36cdf9d2565f04870eac469e86c73f279a17abde Mon Sep 17 00:00:00 2001
From: Fedora Release Engineering 
Date: Fri, 25 Jul 2025 18:57:56 +0000
Subject: [PATCH 18/23] Rebuilt for
 https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild

---
 swig.spec | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/swig.spec b/swig.spec
index 52a6616..9c690f1 100644
--- a/swig.spec
+++ b/swig.spec
@@ -69,7 +69,7 @@
 Summary: Connects C/C++/Objective C to some high-level programming languages
 Name:    swig
 Version: 4.3.1
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: GPL-3.0-or-later AND BSD-3-Clause
 URL:     https://www.swig.org/
 Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
@@ -365,6 +365,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb
 %{_datadir}/%{name}/gdb
 
 %changelog
+* Fri Jul 25 2025 Fedora Release Engineering  - 4.3.1-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
+
 * Wed Jun 25 2025 Yaakov Selkowitz  - 4.3.1-2
 - Add Python 3.14 support
 

From 9a1f1a1a5575241606cc61722646c78ff8001450 Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova 
Date: Fri, 1 Aug 2025 10:27:48 +0200
Subject: [PATCH 19/23] Fix Python DeprecationWarning

---
 ....4.0-Python-DeprecationWarning-fixes.patch | 806 ++++++++++++++++++
 swig.spec                                     |   8 +-
 2 files changed, 813 insertions(+), 1 deletion(-)
 create mode 100644 swig-4.4.0-Python-DeprecationWarning-fixes.patch

diff --git a/swig-4.4.0-Python-DeprecationWarning-fixes.patch b/swig-4.4.0-Python-DeprecationWarning-fixes.patch
new file mode 100644
index 0000000..17b9246
--- /dev/null
+++ b/swig-4.4.0-Python-DeprecationWarning-fixes.patch
@@ -0,0 +1,806 @@
+From 49a7d2b0c6aed00bd07a9a28569020d560c2658c Mon Sep 17 00:00:00 2001
+From: William S Fulton 
+Date: Sat, 10 May 2025 13:47:35 +0100
+Subject: [PATCH 1/5] Python DeprecationWarning fixes
+
+DeprecationWarning fixes when using 'python -Walways' or if using one of the types being warned about:
+
+  DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute
+  DeprecationWarning: builtin type SwigPyObject has no __module__ attribute
+  DeprecationWarning: builtin type swigvarlink has no __module__ attribute
+
+The warning was present if code was generated without using -builtin in 4.3.x.
+The warning was only present if using the Python limited API in 4.2.1 and earlier.
+
+These 3 types were not in any module at all. Now they are in the swig runtime module.
+Docs to follow.
+
+Issue #2881
+Issue #3061
+Issue #3160
+---
+ CHANGES.current       | 11 +++++++++++
+ Lib/python/pyhead.swg |  4 +++-
+ Lib/python/pyrun.swg  | 22 +++++++++++-----------
+ 3 files changed, 25 insertions(+), 12 deletions(-)
+
+#diff --git a/CHANGES.current b/CHANGES.current
+#index 99c8a1d8f..0bce7937f 100644
+#--- a/CHANGES.current
+#+++ b/CHANGES.current
+#@@ -7,6 +7,17 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
+# Version 4.4.0 (in progress)
+# ===========================
+# 
+#+2025-05-10: jschueller, wsfulton
+#+            [Python] #2881 #3061 #3160 DeprecationWarning fixes when using 'python -Walways'
+#+            or if using one of the types being warned about:
+#+
+#+              DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute
+#+              DeprecationWarning: builtin type SwigPyObject has no __module__ attribute
+#+              DeprecationWarning: builtin type swigvarlink has no __module__ attribute
+#+
+#+            The warning was present if code was generated without using -builtin in 4.3.x.
+#+            The warning was only present if using the Python limited API in 4.2.1 and earlier.
+#+
+# 2025-04-30: wsfulton
+#             [Python] #3134 Fix maximum size of strings being marshalled from C/C++
+#             into Python. This has been changed from INT_MAX to PY_SSIZE_T_MAX in line
+diff --git a/Lib/python/pyhead.swg b/Lib/python/pyhead.swg
+index 50dca5bc0..4f238b9f6 100644
+--- a/Lib/python/pyhead.swg
++++ b/Lib/python/pyhead.swg
+@@ -60,6 +60,8 @@ SWIG_Python_str_FromChar(const char *c)
+ #endif
+ }
+ 
++#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION
++
+ /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */
+ # define SWIGPY_USE_CAPSULE
+ #ifdef SWIGPYTHON_BUILTIN
+@@ -67,7 +69,7 @@ SWIG_Python_str_FromChar(const char *c)
+ #else
+ # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME
+ #endif
+-# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME)
++#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME
+ 
+ #if PY_VERSION_HEX < 0x03020000
+ #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
+diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
+index 77d7fccfa..b9e3e7241 100644
+--- a/Lib/python/pyrun.swg
++++ b/Lib/python/pyrun.swg
+@@ -353,7 +353,7 @@ swig_varlink_type(void) {
+       PyObject_HEAD_INIT(NULL)
+       0,                                  /* ob_size */
+ #endif
+-      "swigvarlink",                      /* tp_name */
++      SWIG_RUNTIME_MODULE ".swigvarlink", /* tp_name */
+       sizeof(swig_varlinkobject),         /* tp_basicsize */
+       0,                                  /* tp_itemsize */
+       (destructor) swig_varlink_dealloc,  /* tp_dealloc */
+@@ -424,7 +424,7 @@ swig_varlink_type(void) {
+     { 0, NULL }
+   };
+   PyType_Spec spec = {
+-    "swigvarlink",
++    SWIG_RUNTIME_MODULE ".swigvarlink",
+     sizeof(swig_varlinkobject),
+     0,
+     Py_TPFLAGS_DEFAULT,
+@@ -750,7 +750,7 @@ SwigPyObject_Check(PyObject *op) {
+ #ifdef SWIGPYTHON_BUILTIN
+   if (PyType_IsSubtype(op_type, target_tp))
+     return 1;
+-  return (strcmp(op_type->tp_name, "SwigPyObject") == 0);
++  return (strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0);
+ #else
+ # ifdef Py_LIMITED_API
+   int cmp;
+@@ -766,7 +766,7 @@ SwigPyObject_Check(PyObject *op) {
+   SWIG_Py_DECREF(tp_name);
+   return cmp == 0;
+ # else
+-  return (strcmp(op_type->tp_name, "SwigPyObject") == 0);
++  return (strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0);
+ # endif
+ #endif
+ }
+@@ -966,7 +966,7 @@ SwigPyObject_TypeOnce(void) {
+       PyObject_HEAD_INIT(NULL)
+       0,                                    /* ob_size */
+ #endif
+-      "SwigPyObject",                       /* tp_name */
++      SWIG_RUNTIME_MODULE ".SwigPyObject",  /* tp_name */
+       sizeof(SwigPyObject),                 /* tp_basicsize */
+       0,                                    /* tp_itemsize */
+       (destructor)SwigPyObject_dealloc,     /* tp_dealloc */
+@@ -1061,7 +1061,7 @@ SwigPyObject_TypeOnce(void) {
+     { 0, NULL }
+   };
+   PyType_Spec spec = {
+-    "SwigPyObject",
++    SWIG_RUNTIME_MODULE ".SwigPyObject",
+     sizeof(SwigPyObject),
+     0,
+     Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
+@@ -1160,7 +1160,7 @@ SwigPyPacked_Check(PyObject *op) {
+   SWIG_Py_DECREF(tp_name);
+   return cmp == 0;
+ #else
+-  return (strcmp(op_type->tp_name, "SwigPyPacked") == 0);
++  return (strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0);
+ #endif
+ }
+ 
+@@ -1188,7 +1188,7 @@ SwigPyPacked_TypeOnce(void) {
+       PyObject_HEAD_INIT(NULL)
+       0,                                    /* ob_size */
+ #endif
+-      "SwigPyPacked",                       /* tp_name */
++      SWIG_RUNTIME_MODULE ".SwigPyPacked",  /* tp_name */
+       sizeof(SwigPyPacked),                 /* tp_basicsize */
+       0,                                    /* tp_itemsize */
+       (destructor)SwigPyPacked_dealloc,     /* tp_dealloc */
+@@ -1281,7 +1281,7 @@ SwigPyPacked_TypeOnce(void) {
+     { 0, NULL }
+   };
+   PyType_Spec spec = {
+-    "SwigPyPacked",
++    SWIG_RUNTIME_MODULE ".SwigPyPacked",
+     sizeof(SwigPyPacked),
+     0,
+     Py_TPFLAGS_DEFAULT,
+@@ -1846,10 +1846,10 @@ SWIGRUNTIME void
+ SWIG_Python_SetModule(swig_module_info *swig_module) {
+ #if PY_VERSION_HEX >= 0x03000000
+  /* Add a dummy module object into sys.modules */
+-  PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION);
++  PyObject *module = PyImport_AddModule(SWIG_RUNTIME_MODULE);
+ #else
+   static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
+-  PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
++  PyObject *module = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table);
+ #endif
+   PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
+   if (pointer && module) {
+-- 
+2.50.1
+
+
+From 7ecbb7103dec48bb316baa9ccd71ba7888de7c54 Mon Sep 17 00:00:00 2001
+From: William S Fulton 
+Date: Sun, 11 May 2025 16:02:43 +0100
+Subject: [PATCH 2/5] Add SwigPyObject, SwigPyPacked, swigvarlink to the swig
+ runtime module
+
+Also add SWIG_REFCNT_DEBUG for debugging reference counts when the main
+module is destroyed - there's some work to be done here on reference
+counts!
+---
+ Lib/python/pyinit.swg |  1 +
+ Lib/python/pyrun.swg  | 91 +++++++++++++++++++++++++++++++++----------
+ 2 files changed, 71 insertions(+), 21 deletions(-)
+
+diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg
+index 5bf7097f5..4e25323f6 100644
+--- a/Lib/python/pyinit.swg
++++ b/Lib/python/pyinit.swg
+@@ -261,6 +261,7 @@ SWIG_init(void) {
+   (void)globals;
+ 
+   /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
++  SWIG_runtime_data_module();
+   SWIG_This();
+   SWIG_Python_TypeCache();
+   SwigPyPacked_type();
+diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
+index b9e3e7241..2ef79f348 100644
+--- a/Lib/python/pyrun.swg
++++ b/Lib/python/pyrun.swg
+@@ -114,8 +114,25 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
+ 
+ #endif
+ 
+-/* Append a value to the result obj */
++/* SWIG runtime data Python module */
++static PyObject *Swig_runtime_data_module_global = NULL;
++
++/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */
++SWIGINTERN PyObject *
++SWIG_runtime_data_module() {
++  if (!Swig_runtime_data_module_global) {
++#if PY_VERSION_HEX >= 0x03000000
++    Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE);
++#else
++    static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
++    Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table);
++#endif
++    SWIG_Py_XINCREF(Swig_runtime_data_module_global);
++  }
++  return Swig_runtime_data_module_global;
++}
+ 
++/* Append a value to the result obj */
+ SWIGINTERN PyObject*
+ SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) {
+   if (!result) {
+@@ -341,7 +358,7 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) {
+ 
+ SWIGINTERN PyTypeObject*
+ swig_varlink_type(void) {
+-  static char varlink__doc__[] = "Swig var link object";
++  static char varlink__doc__[] = "Swig variable link object";
+ #ifndef SWIG_HEAPTYPES
+   static PyTypeObject varlink_type;
+   static int type_init = 0;
+@@ -407,10 +424,13 @@ swig_varlink_type(void) {
+       0                                   /* tp_next */
+ #endif
+     };
++    PyObject *runtime_data_module = SWIG_runtime_data_module();
+     varlink_type = tmp;
+     type_init = 1;
+     if (PyType_Ready(&varlink_type) < 0)
+       return NULL;
++    if (PyModule_AddObject(runtime_data_module, "swigvarlink", (PyObject *)&varlink_type) == 0)
++      SWIG_Py_INCREF((PyObject *)&varlink_type);
+   }
+   return &varlink_type;
+ #else
+@@ -430,7 +450,11 @@ swig_varlink_type(void) {
+     Py_TPFLAGS_DEFAULT,
+     slots
+   };
+-  return (PyTypeObject *)PyType_FromSpec(&spec);
++  PyObject *pytype = PyType_FromSpec(&spec);
++  PyObject *runtime_data_module = SWIG_runtime_data_module();
++  if (pytype && PyModule_AddObject(runtime_data_module, "swigvarlink", pytype) == 0)
++    SWIG_Py_INCREF(pytype);
++  return (PyTypeObject *)pytype;
+ #endif
+ }
+ 
+@@ -910,7 +934,7 @@ swigobject_methods[] = {
+ 
+ SWIGRUNTIME PyTypeObject*
+ SwigPyObject_TypeOnce(void) {
+-  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
++  static char swigobject_doc[] = "Swig object holding a C/C++ pointer";
+ #ifndef SWIG_HEAPTYPES
+   static PyNumberMethods SwigPyObject_as_number = {
+     (binaryfunc)0, /*nb_add*/
+@@ -1043,10 +1067,13 @@ SwigPyObject_TypeOnce(void) {
+       0                                     /* tp_next */
+ #endif
+     };
++    PyObject *runtime_data_module = SWIG_runtime_data_module();
+     swigpyobject_type = tmp;
+     type_init = 1;
+     if (PyType_Ready(&swigpyobject_type) != 0)
+       return NULL;
++    if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0)
++      SWIG_Py_INCREF((PyObject *)&swigpyobject_type);
+   }
+   return &swigpyobject_type;
+ #else
+@@ -1067,7 +1094,11 @@ SwigPyObject_TypeOnce(void) {
+     Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
+     slots
+   };
+-  return (PyTypeObject *)PyType_FromSpec(&spec);
++  PyObject *pytype = PyType_FromSpec(&spec);
++  PyObject *runtime_data_module = SWIG_runtime_data_module();
++  if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0)
++    SWIG_Py_INCREF(pytype);
++  return (PyTypeObject *)pytype;
+ #endif
+ }
+ 
+@@ -1150,7 +1181,7 @@ SwigPyPacked_Check(PyObject *op) {
+   PyObject *tp_name;
+ #endif
+   PyTypeObject* op_type = Py_TYPE(op);
+-  if (op_type == SwigPyPacked_TypeOnce())
++  if (op_type == SwigPyPacked_type())
+     return 1;
+ #ifdef Py_LIMITED_API
+   tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__");
+@@ -1176,7 +1207,7 @@ SwigPyPacked_dealloc(PyObject *v)
+ 
+ SWIGRUNTIME PyTypeObject*
+ SwigPyPacked_TypeOnce(void) {
+-  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
++  static char swigpacked_doc[] = "Swig object holding a C/C++ function pointer";
+ #ifndef SWIG_HEAPTYPES
+   static PyTypeObject swigpypacked_type;
+   static int type_init = 0;
+@@ -1265,10 +1296,13 @@ SwigPyPacked_TypeOnce(void) {
+       0                                     /* tp_next */
+ #endif
+     };
++    PyObject *runtime_data_module = SWIG_runtime_data_module();
+     swigpypacked_type = tmp;
+     type_init = 1;
+     if (PyType_Ready(&swigpypacked_type) != 0)
+       return NULL;
++    if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0)
++      SWIG_Py_INCREF((PyObject *)&swigpypacked_type);
+   }
+   return &swigpypacked_type;
+ #else
+@@ -1287,7 +1321,11 @@ SwigPyPacked_TypeOnce(void) {
+     Py_TPFLAGS_DEFAULT,
+     slots
+   };
+-  return (PyTypeObject *)PyType_FromSpec(&spec);
++  PyObject *pytype = PyType_FromSpec(&spec);
++  PyObject *runtime_data_module = SWIG_runtime_data_module();
++  if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0)
++    SWIG_Py_INCREF(pytype);
++  return (PyTypeObject *)pytype;
+ #endif
+ }
+ 
+@@ -1815,6 +1853,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
+ }
+ 
+ 
++#if defined(SWIG_REFCNT_DEBUG)
++#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0))
++#else
++#define SWIG_PYOBJ_REFCNT(OBJ)
++#endif
++
+ static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */
+ 
+ SWIGRUNTIME void
+@@ -1825,7 +1869,7 @@ SWIG_Python_DestroyModule(PyObject *obj)
+   size_t i;
+   if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */
+     return;
+-  for (i =0; i < swig_module->size; ++i) {
++  for (i = 0; i < swig_module->size; ++i) {
+     swig_type_info *ty = types[i];
+     if (ty->owndata) {
+       SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
+@@ -1833,27 +1877,32 @@ SWIG_Python_DestroyModule(PyObject *obj)
+       if (data) SwigPyClientData_Del(data);
+     }
+   }
+-  SWIG_Py_DECREF(SWIG_This());
++  SWIG_Py_XDECREF(Swig_This_global);
++  SWIG_PYOBJ_REFCNT(Swig_This_global);
+   Swig_This_global = NULL;
+-  SWIG_Py_DECREF(SWIG_globals());
++
++  SWIG_Py_XDECREF(Swig_Globals_global);
++  SWIG_PYOBJ_REFCNT(Swig_Globals_global);
+   Swig_Globals_global = NULL;
+-  SWIG_Py_DECREF(SWIG_Python_TypeCache());
++
++  SWIG_Py_XDECREF(Swig_TypeCache_global);
++  SWIG_PYOBJ_REFCNT(Swig_TypeCache_global);
+   Swig_TypeCache_global = NULL;
++
++  SWIG_PYOBJ_REFCNT(Swig_Capsule_global);
+   Swig_Capsule_global = NULL;
++
++  SWIG_Py_XDECREF(Swig_runtime_data_module_global);
++  SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global);
++  Swig_runtime_data_module_global = NULL;
+ }
+ 
+ SWIGRUNTIME void
+ SWIG_Python_SetModule(swig_module_info *swig_module) {
+-#if PY_VERSION_HEX >= 0x03000000
+- /* Add a dummy module object into sys.modules */
+-  PyObject *module = PyImport_AddModule(SWIG_RUNTIME_MODULE);
+-#else
+-  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
+-  PyObject *module = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table);
+-#endif
++  PyObject *runtime_data_module = SWIG_runtime_data_module();
+   PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
+-  if (pointer && module) {
+-    if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) {
++  if (pointer && runtime_data_module) {
++    if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) {
+       ++interpreter_counter;
+       Swig_Capsule_global = pointer;
+     } else {
+-- 
+2.50.1
+
+
+From 53453d51ec3ca111c5c97530d8ee4c6b5184c85e Mon Sep 17 00:00:00 2001
+From: William S Fulton 
+Date: Mon, 12 May 2025 07:25:35 +0100
+Subject: [PATCH 3/5] Rename Python swigvarlink type to SwigVarLink
+
+With this type having just moved into a module, let's also
+make a change to use correct Python naming conventions for the
+name of the type.
+---
+ CHANGES.current      |  8 ++++++
+ Lib/python/pyrun.swg | 64 ++++++++++++++++++++++----------------------
+ 2 files changed, 40 insertions(+), 32 deletions(-)
+
+#diff --git a/CHANGES.current b/CHANGES.current
+#index 0bce7937f..9a2c0f5e2 100644
+#--- a/CHANGES.current
+#+++ b/CHANGES.current
+#@@ -7,6 +7,14 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
+# Version 4.4.0 (in progress)
+# ===========================
+# 
+#+2025-05-11: wsfulton
+#+            [Python] Move the SwigPyObject, SwigPyPacked, SwigVarLink (renamed from
+#+            swigvarlink) support Python types to the SWIG runtime module (currently called
+#+            swig_runtime_data5).
+#+
+#+            Note that these affect the Python runtime implementation, so the recently bumped
+#+            SWIG_RUNTIME_VERSION to 5 for all scripting languages will now include this change.
+#+
+# 2025-05-10: jschueller, wsfulton
+#             [Python] #2881 #3061 #3160 DeprecationWarning fixes when using 'python -Walways'
+#             or if using one of the types being warned about:
+diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
+index 2ef79f348..e7164725d 100644
+--- a/Lib/python/pyrun.swg
++++ b/Lib/python/pyrun.swg
+@@ -257,7 +257,7 @@ typedef struct swig_varlinkobject {
+ } swig_varlinkobject;
+ 
+ SWIGINTERN PyObject *
+-swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) {
++SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) {
+ #if PY_VERSION_HEX >= 0x03000000
+   return PyUnicode_InternFromString("");
+ #else
+@@ -266,7 +266,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) {
+ }
+ 
+ SWIGINTERN PyObject *
+-swig_varlink_str(PyObject *o) {
++SwigVarLink_str(PyObject *o) {
+   swig_varlinkobject *v = (swig_varlinkobject *) o;
+ #if PY_VERSION_HEX >= 0x03000000
+   PyObject *str = PyUnicode_InternFromString("(");
+@@ -305,7 +305,7 @@ swig_varlink_str(PyObject *o) {
+ }
+ 
+ SWIGINTERN void
+-swig_varlink_dealloc(PyObject *o) {
++SwigVarLink_dealloc(PyObject *o) {
+   swig_varlinkobject *v = (swig_varlinkobject *) o;
+   swig_globalvar *var = v->vars;
+   while (var) {
+@@ -317,7 +317,7 @@ swig_varlink_dealloc(PyObject *o) {
+ }
+ 
+ SWIGINTERN PyObject *
+-swig_varlink_getattr(PyObject *o, char *n) {
++SwigVarLink_getattr(PyObject *o, char *n) {
+   swig_varlinkobject *v = (swig_varlinkobject *) o;
+   PyObject *res = NULL;
+   swig_globalvar *var = v->vars;
+@@ -335,7 +335,7 @@ swig_varlink_getattr(PyObject *o, char *n) {
+ }
+ 
+ SWIGINTERN int
+-swig_varlink_setattr(PyObject *o, char *n, PyObject *p) {
++SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) {
+   swig_varlinkobject *v = (swig_varlinkobject *) o;
+   int res = 1;
+   swig_globalvar *var = v->vars;
+@@ -358,7 +358,7 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) {
+ 
+ SWIGINTERN PyTypeObject*
+ swig_varlink_type(void) {
+-  static char varlink__doc__[] = "Swig variable link object";
++  static char SwigVarLink_doc[] = "Swig variable link object";
+ #ifndef SWIG_HEAPTYPES
+   static PyTypeObject varlink_type;
+   static int type_init = 0;
+@@ -370,30 +370,30 @@ swig_varlink_type(void) {
+       PyObject_HEAD_INIT(NULL)
+       0,                                  /* ob_size */
+ #endif
+-      SWIG_RUNTIME_MODULE ".swigvarlink", /* tp_name */
++      SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */
+       sizeof(swig_varlinkobject),         /* tp_basicsize */
+       0,                                  /* tp_itemsize */
+-      (destructor) swig_varlink_dealloc,  /* tp_dealloc */
++      (destructor) SwigVarLink_dealloc,   /* tp_dealloc */
+ #if PY_VERSION_HEX < 0x030800b4
+       (printfunc)0,                       /* tp_print */
+ #else
+       (Py_ssize_t)0,                      /* tp_vectorcall_offset */
+ #endif
+-      (getattrfunc) swig_varlink_getattr, /* tp_getattr */
+-      (setattrfunc) swig_varlink_setattr, /* tp_setattr */
++      (getattrfunc) SwigVarLink_getattr,  /* tp_getattr */
++      (setattrfunc) SwigVarLink_setattr,  /* tp_setattr */
+       0,                                  /* tp_compare */
+-      (reprfunc) swig_varlink_repr,       /* tp_repr */
++      (reprfunc) SwigVarLink_repr,        /* tp_repr */
+       0,                                  /* tp_as_number */
+       0,                                  /* tp_as_sequence */
+       0,                                  /* tp_as_mapping */
+       0,                                  /* tp_hash */
+       0,                                  /* tp_call */
+-      (reprfunc) swig_varlink_str,        /* tp_str */
++      (reprfunc) SwigVarLink_str,         /* tp_str */
+       0,                                  /* tp_getattro */
+       0,                                  /* tp_setattro */
+       0,                                  /* tp_as_buffer */
+       0,                                  /* tp_flags */
+-      varlink__doc__,                     /* tp_doc */
++      SwigVarLink_doc,                    /* tp_doc */
+       0,                                  /* tp_traverse */
+       0,                                  /* tp_clear */
+       0,                                  /* tp_richcompare */
+@@ -429,22 +429,22 @@ swig_varlink_type(void) {
+     type_init = 1;
+     if (PyType_Ready(&varlink_type) < 0)
+       return NULL;
+-    if (PyModule_AddObject(runtime_data_module, "swigvarlink", (PyObject *)&varlink_type) == 0)
++    if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0)
+       SWIG_Py_INCREF((PyObject *)&varlink_type);
+   }
+   return &varlink_type;
+ #else
+   PyType_Slot slots[] = {
+-    { Py_tp_dealloc, (void *)swig_varlink_dealloc },
+-    { Py_tp_repr, (void *)swig_varlink_repr },
+-    { Py_tp_getattr, (void *)swig_varlink_getattr },
+-    { Py_tp_setattr, (void *)swig_varlink_setattr },
+-    { Py_tp_str, (void *)swig_varlink_str },
+-    { Py_tp_doc, (void *)varlink__doc__ },
++    { Py_tp_dealloc, (void *)SwigVarLink_dealloc },
++    { Py_tp_repr, (void *)SwigVarLink_repr },
++    { Py_tp_getattr, (void *)SwigVarLink_getattr },
++    { Py_tp_setattr, (void *)SwigVarLink_setattr },
++    { Py_tp_str, (void *)SwigVarLink_str },
++    { Py_tp_doc, (void *)SwigVarLink_doc },
+     { 0, NULL }
+   };
+   PyType_Spec spec = {
+-    SWIG_RUNTIME_MODULE ".swigvarlink",
++    SWIG_RUNTIME_MODULE ".SwigVarLink",
+     sizeof(swig_varlinkobject),
+     0,
+     Py_TPFLAGS_DEFAULT,
+@@ -452,7 +452,7 @@ swig_varlink_type(void) {
+   };
+   PyObject *pytype = PyType_FromSpec(&spec);
+   PyObject *runtime_data_module = SWIG_runtime_data_module();
+-  if (pytype && PyModule_AddObject(runtime_data_module, "swigvarlink", pytype) == 0)
++  if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0)
+     SWIG_Py_INCREF(pytype);
+   return (PyTypeObject *)pytype;
+ #endif
+@@ -715,7 +715,7 @@ SwigPyObject_repr(SwigPyObject *v)
+ }
+ 
+ /* We need a version taking two PyObject* parameters so it's a valid
+- * PyCFunction to use in swigobject_methods[]. */
++ * PyCFunction to use in SwigPyObject_methods[]. */
+ SWIGRUNTIME PyObject *
+ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
+ {
+@@ -922,7 +922,7 @@ SwigPyObject_own(PyObject *v, PyObject *args)
+ }
+ 
+ static PyMethodDef
+-swigobject_methods[] = {
++SwigPyObject_methods[] = {
+   {"disown",  SwigPyObject_disown,  METH_NOARGS,  "releases ownership of the pointer"},
+   {"acquire", SwigPyObject_acquire, METH_NOARGS,  "acquires ownership of the pointer"},
+   {"own",     SwigPyObject_own,     METH_VARARGS, "returns/sets ownership of the pointer"},
+@@ -934,7 +934,7 @@ swigobject_methods[] = {
+ 
+ SWIGRUNTIME PyTypeObject*
+ SwigPyObject_TypeOnce(void) {
+-  static char swigobject_doc[] = "Swig object holding a C/C++ pointer";
++  static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer";
+ #ifndef SWIG_HEAPTYPES
+   static PyNumberMethods SwigPyObject_as_number = {
+     (binaryfunc)0, /*nb_add*/
+@@ -1017,14 +1017,14 @@ SwigPyObject_TypeOnce(void) {
+       0,                                    /* tp_setattro */
+       0,                                    /* tp_as_buffer */
+       Py_TPFLAGS_DEFAULT,                   /* tp_flags */
+-      swigobject_doc,                       /* tp_doc */
++      SwigPyObject_doc,                     /* tp_doc */
+       0,                                    /* tp_traverse */
+       0,                                    /* tp_clear */
+       (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
+       0,                                    /* tp_weaklistoffset */
+       0,                                    /* tp_iter */
+       0,                                    /* tp_iternext */
+-      swigobject_methods,                   /* tp_methods */
++      SwigPyObject_methods,                 /* tp_methods */
+       0,                                    /* tp_members */
+       0,                                    /* tp_getset */
+       0,                                    /* tp_base */
+@@ -1081,9 +1081,9 @@ SwigPyObject_TypeOnce(void) {
+     { Py_tp_dealloc, (void *)SwigPyObject_dealloc },
+     { Py_tp_repr, (void *)SwigPyObject_repr },
+     { Py_tp_getattro, (void *)PyObject_GenericGetAttr },
+-    { Py_tp_doc, (void *)swigobject_doc },
++    { Py_tp_doc, (void *)SwigPyObject_doc },
+     { Py_tp_richcompare, (void *)SwigPyObject_richcompare },
+-    { Py_tp_methods, (void *)swigobject_methods },
++    { Py_tp_methods, (void *)SwigPyObject_methods },
+     { Py_nb_int, (void *)SwigPyObject_long },
+     { 0, NULL }
+   };
+@@ -1207,7 +1207,7 @@ SwigPyPacked_dealloc(PyObject *v)
+ 
+ SWIGRUNTIME PyTypeObject*
+ SwigPyPacked_TypeOnce(void) {
+-  static char swigpacked_doc[] = "Swig object holding a C/C++ function pointer";
++  static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer";
+ #ifndef SWIG_HEAPTYPES
+   static PyTypeObject swigpypacked_type;
+   static int type_init = 0;
+@@ -1246,7 +1246,7 @@ SwigPyPacked_TypeOnce(void) {
+       0,                                    /* tp_setattro */
+       0,                                    /* tp_as_buffer */
+       Py_TPFLAGS_DEFAULT,                   /* tp_flags */
+-      swigpacked_doc,                       /* tp_doc */
++      SwigPyPacked_doc,                     /* tp_doc */
+       0,                                    /* tp_traverse */
+       0,                                    /* tp_clear */
+       0,                                    /* tp_richcompare */
+@@ -1311,7 +1311,7 @@ SwigPyPacked_TypeOnce(void) {
+     { Py_tp_repr, (void *)SwigPyPacked_repr },
+     { Py_tp_str, (void *)SwigPyPacked_str },
+     { Py_tp_getattro, (void *)PyObject_GenericGetAttr },
+-    { Py_tp_doc, (void *)swigpacked_doc },
++    { Py_tp_doc, (void *)SwigPyPacked_doc },
+     { 0, NULL }
+   };
+   PyType_Spec spec = {
+-- 
+2.50.1
+
+
+From 831fc6069115b8a31bed5d0bcae221825cd43c18 Mon Sep 17 00:00:00 2001
+From: William S Fulton 
+Date: Tue, 13 May 2025 08:40:45 +0100
+Subject: [PATCH 4/5] Add docs on the python runtime module
+
+---
+ Doc/Manual/Python.html | 50 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 50 insertions(+)
+
+diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
+index 7427ca4cf..cc82e9762 100644
+--- a/Doc/Manual/Python.html
++++ b/Doc/Manual/Python.html
+@@ -1000,6 +1000,10 @@ module name, make sure you don't use the same name as a built-in
+ Python command or standard module name.
+ 

+ ++

++There is also a further 'behind the scenes' Python runtime module, but this implementation detail is covered later. ++

++ +

33.3.2 Functions

+ + +@@ -2704,6 +2708,52 @@ in the file python/pyopers.swg in the SWIG library. +

+ + ++

33.4.3 Python runtime module

++ ++

++In addition to the two Python modules that are generated by SWIG, there is also a third 'behind the scenes' Python runtime module. ++The runtime module is very much an implementation level detail, but is mentioned here for completeness and for the inquisitive! ++

++ ++

++SWIG implements a run-time type checker for checking a Python type/class as it passes between the Python and C/C++ layers. ++It is also used when multiple SWIG modules need to share type information with each other (when using the %import directive). ++More details can be found in the SWIG runtime code and run-time type checker sections. ++The runtime module contains the following: ++

++ ++
    ++
  1. A Python Capsule containing a pointer to the underlying C module data structure used by the runtime type checker. For multiple modules to access the common runtime implementation. The Capsule is named type_pointer_capsule except when using -builtin when it is instead called type_pointer_capsule_builtin.
  2. ++
  3. The builtin type SwigPyObject - Swig object holding a C/C++ pointer. For 'normal' pointers, that is, not for function pointers nor member function pointers.
  4. ++
  5. The builtin type SwigPyPacked - Swig object holding a C/C++ function pointer. For C pointers to a function or C++ member function pointers.
  6. ++
  7. The builtin type SwigVarLink - Swig variable link object. The type used by the 'cvar' field for accessing C/C++ global variables.
  8. ++
++ ++

++If multiple SWIG modules are being used, the C/C++ wrapped proxy classes/types can be shared or used across the different modules via the SWIG runtime. ++The runtime is accessed and shared via the Capsule in the runtime module. ++The Python runtime module is implemented as a Python builtin module. While users are unlikely to use or import the runtime module directly, it can be inspected simply enough. ++The name of the module is swig_runtime_data appended with the runtime version as defined by SWIG_RUNTIME_VERSION. ++First import your SWIG generated module. Next find the exact runtime module name so you know what to import before inspecting it with say dir. ++The interpreter session below demonstrates this with a SWIG generated module called example: ++

++ ++
++
++>>> import example
++>>> import sys
++>>> list(m for m in sys.modules if m.startswith("swig_runtime_data"))
++['swig_runtime_data5']
++>>> import swig_runtime_data5
++>>> dir(swig_runtime_data5)
++['SwigPyObject', 'SwigPyPacked', 'SwigVarLink', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'type_pointer_capsule']
++
++
++ ++

++Compatibility Note: Only the Capsule was stored in the Python runtime module prior to SWIG-4.4.0. ++

++ +

33.4.3 Memory management

+ + +-- +2.50.1 + + +From d966fd3ba18370b5bf34b67ff376d88fb6d3e65b Mon Sep 17 00:00:00 2001 +From: William S Fulton +Date: Tue, 13 May 2025 21:42:56 +0100 +Subject: [PATCH 5/5] Test swig runtime module contains expected names + +--- + .../python/python_moduleimport_runme.py | 17 +++++++++++++++++ + Examples/test-suite/python_moduleimport.i | 2 ++ + 2 files changed, 19 insertions(+) + +diff --git a/Examples/test-suite/python/python_moduleimport_runme.py b/Examples/test-suite/python/python_moduleimport_runme.py +index cdb860730..8e0aa6121 100644 +--- a/Examples/test-suite/python/python_moduleimport_runme.py ++++ b/Examples/test-suite/python/python_moduleimport_runme.py +@@ -1,7 +1,24 @@ + import python_moduleimport + ++# Test custom moduleimport in %module + if python_moduleimport.simple_function(99) != 99: + raise RuntimeError("simple_function") + + if python_moduleimport.extra_import_variable != "custom import of _python_moduleimport": + raise RuntimeError("custom import") ++ ++ ++# Test the swig runtime module contains the expected names/types ++import importlib ++swig_runtime_version = python_moduleimport.runtime_version() ++swig_runtime_data = importlib.import_module("swig_runtime_data" + swig_runtime_version) # Equivalent to (for version 5): import swig_runtime_data5 as swig_runtime_data ++ ++names = dir(swig_runtime_data) ++expected_names = ("SwigPyObject", "SwigPyPacked", "SwigVarLink") ++for name in expected_names: ++ if name not in names: ++ raise RuntimeError("{} not in {}".format(name, names)) ++ ++cvar_type = type(python_moduleimport.cvar) ++if cvar_type.__name__ != "SwigVarLink": ++ raise RuntimeError("cvar type name is incorrect: {}".format(cvar_type.__name__)) +diff --git a/Examples/test-suite/python_moduleimport.i b/Examples/test-suite/python_moduleimport.i +index f62547dcd..f0d203433 100644 +--- a/Examples/test-suite/python_moduleimport.i ++++ b/Examples/test-suite/python_moduleimport.i +@@ -23,4 +23,6 @@ from $module import * + + %inline %{ + int simple_function(int i) { return i; } ++int globalvar = 99; ++const char * runtime_version() { return SWIG_RUNTIME_VERSION; } + %} +-- +2.50.1 + diff --git a/swig.spec b/swig.spec index 9c690f1..7aa16c3 100644 --- a/swig.spec +++ b/swig.spec @@ -69,7 +69,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.3.1 -Release: 3%{?dist} +Release: 4%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -82,6 +82,9 @@ Source4: ccache-swig.csh %endif # https://github.com/swig/swig/pull/3159 Patch0: swig-python-Python-3.14-support.patch +# Python DeprecationWarning fixes - in upstream after 4.4.0 +# https://github.com/swig/swig/issues/2881 +Patch1: swig-4.4.0-Python-DeprecationWarning-fixes.patch BuildRequires: coreutils BuildRequires: findutils @@ -365,6 +368,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Thu Jul 31 2025 Jitka Plesnikova - 4.3.1-4 +- Fix Python DeprecationWarning + * Fri Jul 25 2025 Fedora Release Engineering - 4.3.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From ad62c005a3acb8b4cd79580fd0d8e6f7051f5f2c Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Thu, 7 Aug 2025 10:42:08 -0600 Subject: [PATCH 20/23] Rebuild for Octave 10.2 --- swig.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swig.spec b/swig.spec index 7aa16c3..4861e11 100644 --- a/swig.spec +++ b/swig.spec @@ -69,7 +69,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.3.1 -Release: 4%{?dist} +Release: 5%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -368,6 +368,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Thu Aug 07 2025 Orion Poplawski - 4.3.1-5 +- Rebuild for Octave 10.2 + * Thu Jul 31 2025 Jitka Plesnikova - 4.3.1-4 - Fix Python DeprecationWarning From 28a355063e5bef532843d6e332ee5e2a6da050fd Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 13 Oct 2025 18:22:54 +0100 Subject: [PATCH 21/23] OCaml 5.4.0 rebuild --- swig.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swig.spec b/swig.spec index 4861e11..d60b620 100644 --- a/swig.spec +++ b/swig.spec @@ -69,7 +69,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.3.1 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -368,6 +368,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Mon Oct 13 2025 Richard W.M. Jones - 4.3.1-6 +- OCaml 5.4.0 rebuild + * Thu Aug 07 2025 Orion Poplawski - 4.3.1-5 - Rebuild for Octave 10.2 From 6eb1208d37dd0ce6bd8cf17f8877154879b1853e Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Thu, 23 Oct 2025 12:20:59 +0200 Subject: [PATCH 22/23] 4.4.0 bump (rhbz#2405182) --- .gitignore | 1 + sources | 2 +- swig.spec | 14 ++++++-------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 34ba3f1..a1b574c 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ swig-2.0.0.tar.gz /swig-4.2.1.tar.gz /swig-4.3.0.tar.gz /swig-4.3.1.tar.gz +/swig-4.4.0.tar.gz diff --git a/sources b/sources index 581ec8f..06c0ef9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (swig-4.3.1.tar.gz) = 8958f7bc3345549a9bc4e00aa8d40a99f6c4bb92b95d627c8796cf8f8d1ba0041a89cab542f171778c2b26aa2a877767181ae9bd2c05fd055f373a32a463399c +SHA512 (swig-4.4.0.tar.gz) = 0cd4625166240f73075c22e140336b8e39f0f98d4343caba472b8eb3fa64561152e6978d5735d883cf62af10b84a9f0e20b3bb40288341a82c68a4cb79e46f5f diff --git a/swig.spec b/swig.spec index 7aa16c3..30cbcc9 100644 --- a/swig.spec +++ b/swig.spec @@ -56,7 +56,7 @@ %else # Temporary disable java tests, because they doesn't pass with java-21-openjdk # https://github.com/swig/swig/issues/2767 -%{!?javalang:%global javalang 0} +%{!?javalang:%global javalang 1} %endif # Do not run Go tests, they failed with 4.0.0 on ppc64le, s390 @@ -68,8 +68,8 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig -Version: 4.3.1 -Release: 4%{?dist} +Version: 4.4.0 +Release: 1%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -80,11 +80,6 @@ Source2: description-ccache.h2m Source3: ccache-swig.sh Source4: ccache-swig.csh %endif -# https://github.com/swig/swig/pull/3159 -Patch0: swig-python-Python-3.14-support.patch -# Python DeprecationWarning fixes - in upstream after 4.4.0 -# https://github.com/swig/swig/issues/2881 -Patch1: swig-4.4.0-Python-DeprecationWarning-fixes.patch BuildRequires: coreutils BuildRequires: findutils @@ -368,6 +363,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Tue Oct 21 2025 Jitka Plesnikova - 4.4.0-1 +- 4.4.0 bump (rhbz#2405182) + * Thu Jul 31 2025 Jitka Plesnikova - 4.3.1-4 - Fix Python DeprecationWarning From 74b108992c47cd36a336557f97c70fd5aed0dbf3 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Wed, 10 Dec 2025 15:58:52 +0100 Subject: [PATCH 23/23] 4.4.1 bump (rhbz#2419819, rhbz#2415440) --- .gitignore | 1 + sources | 2 +- ....4.0-Python-DeprecationWarning-fixes.patch | 806 ------------------ swig.spec | 5 +- 4 files changed, 6 insertions(+), 808 deletions(-) delete mode 100644 swig-4.4.0-Python-DeprecationWarning-fixes.patch diff --git a/.gitignore b/.gitignore index a1b574c..8cec1dc 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ swig-2.0.0.tar.gz /swig-4.3.0.tar.gz /swig-4.3.1.tar.gz /swig-4.4.0.tar.gz +/swig-4.4.1.tar.gz diff --git a/sources b/sources index 06c0ef9..f6fe3ce 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (swig-4.4.0.tar.gz) = 0cd4625166240f73075c22e140336b8e39f0f98d4343caba472b8eb3fa64561152e6978d5735d883cf62af10b84a9f0e20b3bb40288341a82c68a4cb79e46f5f +SHA512 (swig-4.4.1.tar.gz) = 103ddb4a5914f28e6739a006d35042c701e55ba05066acff3f3609befb5f43f253ea717fc41d06c93d8fb187ded4399c12c94665b93dc06d0fb835069391c7c7 diff --git a/swig-4.4.0-Python-DeprecationWarning-fixes.patch b/swig-4.4.0-Python-DeprecationWarning-fixes.patch deleted file mode 100644 index 17b9246..0000000 --- a/swig-4.4.0-Python-DeprecationWarning-fixes.patch +++ /dev/null @@ -1,806 +0,0 @@ -From 49a7d2b0c6aed00bd07a9a28569020d560c2658c Mon Sep 17 00:00:00 2001 -From: William S Fulton -Date: Sat, 10 May 2025 13:47:35 +0100 -Subject: [PATCH 1/5] Python DeprecationWarning fixes - -DeprecationWarning fixes when using 'python -Walways' or if using one of the types being warned about: - - DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute - DeprecationWarning: builtin type SwigPyObject has no __module__ attribute - DeprecationWarning: builtin type swigvarlink has no __module__ attribute - -The warning was present if code was generated without using -builtin in 4.3.x. -The warning was only present if using the Python limited API in 4.2.1 and earlier. - -These 3 types were not in any module at all. Now they are in the swig runtime module. -Docs to follow. - -Issue #2881 -Issue #3061 -Issue #3160 ---- - CHANGES.current | 11 +++++++++++ - Lib/python/pyhead.swg | 4 +++- - Lib/python/pyrun.swg | 22 +++++++++++----------- - 3 files changed, 25 insertions(+), 12 deletions(-) - -#diff --git a/CHANGES.current b/CHANGES.current -#index 99c8a1d8f..0bce7937f 100644 -#--- a/CHANGES.current -#+++ b/CHANGES.current -#@@ -7,6 +7,17 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ -# Version 4.4.0 (in progress) -# =========================== -# -#+2025-05-10: jschueller, wsfulton -#+ [Python] #2881 #3061 #3160 DeprecationWarning fixes when using 'python -Walways' -#+ or if using one of the types being warned about: -#+ -#+ DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute -#+ DeprecationWarning: builtin type SwigPyObject has no __module__ attribute -#+ DeprecationWarning: builtin type swigvarlink has no __module__ attribute -#+ -#+ The warning was present if code was generated without using -builtin in 4.3.x. -#+ The warning was only present if using the Python limited API in 4.2.1 and earlier. -#+ -# 2025-04-30: wsfulton -# [Python] #3134 Fix maximum size of strings being marshalled from C/C++ -# into Python. This has been changed from INT_MAX to PY_SSIZE_T_MAX in line -diff --git a/Lib/python/pyhead.swg b/Lib/python/pyhead.swg -index 50dca5bc0..4f238b9f6 100644 ---- a/Lib/python/pyhead.swg -+++ b/Lib/python/pyhead.swg -@@ -60,6 +60,8 @@ SWIG_Python_str_FromChar(const char *c) - #endif - } - -+#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION -+ - /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ - # define SWIGPY_USE_CAPSULE - #ifdef SWIGPYTHON_BUILTIN -@@ -67,7 +69,7 @@ SWIG_Python_str_FromChar(const char *c) - #else - # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME - #endif --# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) -+#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME - - #if PY_VERSION_HEX < 0x03020000 - #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) -diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg -index 77d7fccfa..b9e3e7241 100644 ---- a/Lib/python/pyrun.swg -+++ b/Lib/python/pyrun.swg -@@ -353,7 +353,7 @@ swig_varlink_type(void) { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - #endif -- "swigvarlink", /* tp_name */ -+ SWIG_RUNTIME_MODULE ".swigvarlink", /* tp_name */ - sizeof(swig_varlinkobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ -@@ -424,7 +424,7 @@ swig_varlink_type(void) { - { 0, NULL } - }; - PyType_Spec spec = { -- "swigvarlink", -+ SWIG_RUNTIME_MODULE ".swigvarlink", - sizeof(swig_varlinkobject), - 0, - Py_TPFLAGS_DEFAULT, -@@ -750,7 +750,7 @@ SwigPyObject_Check(PyObject *op) { - #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) - return 1; -- return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -+ return (strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0); - #else - # ifdef Py_LIMITED_API - int cmp; -@@ -766,7 +766,7 @@ SwigPyObject_Check(PyObject *op) { - SWIG_Py_DECREF(tp_name); - return cmp == 0; - # else -- return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -+ return (strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0); - # endif - #endif - } -@@ -966,7 +966,7 @@ SwigPyObject_TypeOnce(void) { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - #endif -- "SwigPyObject", /* tp_name */ -+ SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ - sizeof(SwigPyObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SwigPyObject_dealloc, /* tp_dealloc */ -@@ -1061,7 +1061,7 @@ SwigPyObject_TypeOnce(void) { - { 0, NULL } - }; - PyType_Spec spec = { -- "SwigPyObject", -+ SWIG_RUNTIME_MODULE ".SwigPyObject", - sizeof(SwigPyObject), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, -@@ -1160,7 +1160,7 @@ SwigPyPacked_Check(PyObject *op) { - SWIG_Py_DECREF(tp_name); - return cmp == 0; - #else -- return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); -+ return (strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0); - #endif - } - -@@ -1188,7 +1188,7 @@ SwigPyPacked_TypeOnce(void) { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - #endif -- "SwigPyPacked", /* tp_name */ -+ SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ - sizeof(SwigPyPacked), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ -@@ -1281,7 +1281,7 @@ SwigPyPacked_TypeOnce(void) { - { 0, NULL } - }; - PyType_Spec spec = { -- "SwigPyPacked", -+ SWIG_RUNTIME_MODULE ".SwigPyPacked", - sizeof(SwigPyPacked), - 0, - Py_TPFLAGS_DEFAULT, -@@ -1846,10 +1846,10 @@ SWIGRUNTIME void - SWIG_Python_SetModule(swig_module_info *swig_module) { - #if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ -- PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -+ PyObject *module = PyImport_AddModule(SWIG_RUNTIME_MODULE); - #else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ -- PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -+ PyObject *module = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); - #endif - PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { --- -2.50.1 - - -From 7ecbb7103dec48bb316baa9ccd71ba7888de7c54 Mon Sep 17 00:00:00 2001 -From: William S Fulton -Date: Sun, 11 May 2025 16:02:43 +0100 -Subject: [PATCH 2/5] Add SwigPyObject, SwigPyPacked, swigvarlink to the swig - runtime module - -Also add SWIG_REFCNT_DEBUG for debugging reference counts when the main -module is destroyed - there's some work to be done here on reference -counts! ---- - Lib/python/pyinit.swg | 1 + - Lib/python/pyrun.swg | 91 +++++++++++++++++++++++++++++++++---------- - 2 files changed, 71 insertions(+), 21 deletions(-) - -diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg -index 5bf7097f5..4e25323f6 100644 ---- a/Lib/python/pyinit.swg -+++ b/Lib/python/pyinit.swg -@@ -261,6 +261,7 @@ SWIG_init(void) { - (void)globals; - - /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ -+ SWIG_runtime_data_module(); - SWIG_This(); - SWIG_Python_TypeCache(); - SwigPyPacked_type(); -diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg -index b9e3e7241..2ef79f348 100644 ---- a/Lib/python/pyrun.swg -+++ b/Lib/python/pyrun.swg -@@ -114,8 +114,25 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { - - #endif - --/* Append a value to the result obj */ -+/* SWIG runtime data Python module */ -+static PyObject *Swig_runtime_data_module_global = NULL; -+ -+/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ -+SWIGINTERN PyObject * -+SWIG_runtime_data_module() { -+ if (!Swig_runtime_data_module_global) { -+#if PY_VERSION_HEX >= 0x03000000 -+ Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); -+#else -+ static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ -+ Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); -+#endif -+ SWIG_Py_XINCREF(Swig_runtime_data_module_global); -+ } -+ return Swig_runtime_data_module_global; -+} - -+/* Append a value to the result obj */ - SWIGINTERN PyObject* - SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { - if (!result) { -@@ -341,7 +358,7 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { - - SWIGINTERN PyTypeObject* - swig_varlink_type(void) { -- static char varlink__doc__[] = "Swig var link object"; -+ static char varlink__doc__[] = "Swig variable link object"; - #ifndef SWIG_HEAPTYPES - static PyTypeObject varlink_type; - static int type_init = 0; -@@ -407,10 +424,13 @@ swig_varlink_type(void) { - 0 /* tp_next */ - #endif - }; -+ PyObject *runtime_data_module = SWIG_runtime_data_module(); - varlink_type = tmp; - type_init = 1; - if (PyType_Ready(&varlink_type) < 0) - return NULL; -+ if (PyModule_AddObject(runtime_data_module, "swigvarlink", (PyObject *)&varlink_type) == 0) -+ SWIG_Py_INCREF((PyObject *)&varlink_type); - } - return &varlink_type; - #else -@@ -430,7 +450,11 @@ swig_varlink_type(void) { - Py_TPFLAGS_DEFAULT, - slots - }; -- return (PyTypeObject *)PyType_FromSpec(&spec); -+ PyObject *pytype = PyType_FromSpec(&spec); -+ PyObject *runtime_data_module = SWIG_runtime_data_module(); -+ if (pytype && PyModule_AddObject(runtime_data_module, "swigvarlink", pytype) == 0) -+ SWIG_Py_INCREF(pytype); -+ return (PyTypeObject *)pytype; - #endif - } - -@@ -910,7 +934,7 @@ swigobject_methods[] = { - - SWIGRUNTIME PyTypeObject* - SwigPyObject_TypeOnce(void) { -- static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; -+ static char swigobject_doc[] = "Swig object holding a C/C++ pointer"; - #ifndef SWIG_HEAPTYPES - static PyNumberMethods SwigPyObject_as_number = { - (binaryfunc)0, /*nb_add*/ -@@ -1043,10 +1067,13 @@ SwigPyObject_TypeOnce(void) { - 0 /* tp_next */ - #endif - }; -+ PyObject *runtime_data_module = SWIG_runtime_data_module(); - swigpyobject_type = tmp; - type_init = 1; - if (PyType_Ready(&swigpyobject_type) != 0) - return NULL; -+ if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) -+ SWIG_Py_INCREF((PyObject *)&swigpyobject_type); - } - return &swigpyobject_type; - #else -@@ -1067,7 +1094,11 @@ SwigPyObject_TypeOnce(void) { - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, - slots - }; -- return (PyTypeObject *)PyType_FromSpec(&spec); -+ PyObject *pytype = PyType_FromSpec(&spec); -+ PyObject *runtime_data_module = SWIG_runtime_data_module(); -+ if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) -+ SWIG_Py_INCREF(pytype); -+ return (PyTypeObject *)pytype; - #endif - } - -@@ -1150,7 +1181,7 @@ SwigPyPacked_Check(PyObject *op) { - PyObject *tp_name; - #endif - PyTypeObject* op_type = Py_TYPE(op); -- if (op_type == SwigPyPacked_TypeOnce()) -+ if (op_type == SwigPyPacked_type()) - return 1; - #ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); -@@ -1176,7 +1207,7 @@ SwigPyPacked_dealloc(PyObject *v) - - SWIGRUNTIME PyTypeObject* - SwigPyPacked_TypeOnce(void) { -- static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; -+ static char swigpacked_doc[] = "Swig object holding a C/C++ function pointer"; - #ifndef SWIG_HEAPTYPES - static PyTypeObject swigpypacked_type; - static int type_init = 0; -@@ -1265,10 +1296,13 @@ SwigPyPacked_TypeOnce(void) { - 0 /* tp_next */ - #endif - }; -+ PyObject *runtime_data_module = SWIG_runtime_data_module(); - swigpypacked_type = tmp; - type_init = 1; - if (PyType_Ready(&swigpypacked_type) != 0) - return NULL; -+ if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) -+ SWIG_Py_INCREF((PyObject *)&swigpypacked_type); - } - return &swigpypacked_type; - #else -@@ -1287,7 +1321,11 @@ SwigPyPacked_TypeOnce(void) { - Py_TPFLAGS_DEFAULT, - slots - }; -- return (PyTypeObject *)PyType_FromSpec(&spec); -+ PyObject *pytype = PyType_FromSpec(&spec); -+ PyObject *runtime_data_module = SWIG_runtime_data_module(); -+ if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) -+ SWIG_Py_INCREF(pytype); -+ return (PyTypeObject *)pytype; - #endif - } - -@@ -1815,6 +1853,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { - } - - -+#if defined(SWIG_REFCNT_DEBUG) -+#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) -+#else -+#define SWIG_PYOBJ_REFCNT(OBJ) -+#endif -+ - static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ - - SWIGRUNTIME void -@@ -1825,7 +1869,7 @@ SWIG_Python_DestroyModule(PyObject *obj) - size_t i; - if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ - return; -- for (i =0; i < swig_module->size; ++i) { -+ for (i = 0; i < swig_module->size; ++i) { - swig_type_info *ty = types[i]; - if (ty->owndata) { - SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; -@@ -1833,27 +1877,32 @@ SWIG_Python_DestroyModule(PyObject *obj) - if (data) SwigPyClientData_Del(data); - } - } -- SWIG_Py_DECREF(SWIG_This()); -+ SWIG_Py_XDECREF(Swig_This_global); -+ SWIG_PYOBJ_REFCNT(Swig_This_global); - Swig_This_global = NULL; -- SWIG_Py_DECREF(SWIG_globals()); -+ -+ SWIG_Py_XDECREF(Swig_Globals_global); -+ SWIG_PYOBJ_REFCNT(Swig_Globals_global); - Swig_Globals_global = NULL; -- SWIG_Py_DECREF(SWIG_Python_TypeCache()); -+ -+ SWIG_Py_XDECREF(Swig_TypeCache_global); -+ SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); - Swig_TypeCache_global = NULL; -+ -+ SWIG_PYOBJ_REFCNT(Swig_Capsule_global); - Swig_Capsule_global = NULL; -+ -+ SWIG_Py_XDECREF(Swig_runtime_data_module_global); -+ SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); -+ Swig_runtime_data_module_global = NULL; - } - - SWIGRUNTIME void - SWIG_Python_SetModule(swig_module_info *swig_module) { --#if PY_VERSION_HEX >= 0x03000000 -- /* Add a dummy module object into sys.modules */ -- PyObject *module = PyImport_AddModule(SWIG_RUNTIME_MODULE); --#else -- static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ -- PyObject *module = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); --#endif -+ PyObject *runtime_data_module = SWIG_runtime_data_module(); - PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); -- if (pointer && module) { -- if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { -+ if (pointer && runtime_data_module) { -+ if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { - ++interpreter_counter; - Swig_Capsule_global = pointer; - } else { --- -2.50.1 - - -From 53453d51ec3ca111c5c97530d8ee4c6b5184c85e Mon Sep 17 00:00:00 2001 -From: William S Fulton -Date: Mon, 12 May 2025 07:25:35 +0100 -Subject: [PATCH 3/5] Rename Python swigvarlink type to SwigVarLink - -With this type having just moved into a module, let's also -make a change to use correct Python naming conventions for the -name of the type. ---- - CHANGES.current | 8 ++++++ - Lib/python/pyrun.swg | 64 ++++++++++++++++++++++---------------------- - 2 files changed, 40 insertions(+), 32 deletions(-) - -#diff --git a/CHANGES.current b/CHANGES.current -#index 0bce7937f..9a2c0f5e2 100644 -#--- a/CHANGES.current -#+++ b/CHANGES.current -#@@ -7,6 +7,14 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ -# Version 4.4.0 (in progress) -# =========================== -# -#+2025-05-11: wsfulton -#+ [Python] Move the SwigPyObject, SwigPyPacked, SwigVarLink (renamed from -#+ swigvarlink) support Python types to the SWIG runtime module (currently called -#+ swig_runtime_data5). -#+ -#+ Note that these affect the Python runtime implementation, so the recently bumped -#+ SWIG_RUNTIME_VERSION to 5 for all scripting languages will now include this change. -#+ -# 2025-05-10: jschueller, wsfulton -# [Python] #2881 #3061 #3160 DeprecationWarning fixes when using 'python -Walways' -# or if using one of the types being warned about: -diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg -index 2ef79f348..e7164725d 100644 ---- a/Lib/python/pyrun.swg -+++ b/Lib/python/pyrun.swg -@@ -257,7 +257,7 @@ typedef struct swig_varlinkobject { - } swig_varlinkobject; - - SWIGINTERN PyObject * --swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { -+SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { - #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_InternFromString(""); - #else -@@ -266,7 +266,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { - } - - SWIGINTERN PyObject * --swig_varlink_str(PyObject *o) { -+SwigVarLink_str(PyObject *o) { - swig_varlinkobject *v = (swig_varlinkobject *) o; - #if PY_VERSION_HEX >= 0x03000000 - PyObject *str = PyUnicode_InternFromString("("); -@@ -305,7 +305,7 @@ swig_varlink_str(PyObject *o) { - } - - SWIGINTERN void --swig_varlink_dealloc(PyObject *o) { -+SwigVarLink_dealloc(PyObject *o) { - swig_varlinkobject *v = (swig_varlinkobject *) o; - swig_globalvar *var = v->vars; - while (var) { -@@ -317,7 +317,7 @@ swig_varlink_dealloc(PyObject *o) { - } - - SWIGINTERN PyObject * --swig_varlink_getattr(PyObject *o, char *n) { -+SwigVarLink_getattr(PyObject *o, char *n) { - swig_varlinkobject *v = (swig_varlinkobject *) o; - PyObject *res = NULL; - swig_globalvar *var = v->vars; -@@ -335,7 +335,7 @@ swig_varlink_getattr(PyObject *o, char *n) { - } - - SWIGINTERN int --swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { -+SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { - swig_varlinkobject *v = (swig_varlinkobject *) o; - int res = 1; - swig_globalvar *var = v->vars; -@@ -358,7 +358,7 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { - - SWIGINTERN PyTypeObject* - swig_varlink_type(void) { -- static char varlink__doc__[] = "Swig variable link object"; -+ static char SwigVarLink_doc[] = "Swig variable link object"; - #ifndef SWIG_HEAPTYPES - static PyTypeObject varlink_type; - static int type_init = 0; -@@ -370,30 +370,30 @@ swig_varlink_type(void) { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - #endif -- SWIG_RUNTIME_MODULE ".swigvarlink", /* tp_name */ -+ SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ - sizeof(swig_varlinkobject), /* tp_basicsize */ - 0, /* tp_itemsize */ -- (destructor) swig_varlink_dealloc, /* tp_dealloc */ -+ (destructor) SwigVarLink_dealloc, /* tp_dealloc */ - #if PY_VERSION_HEX < 0x030800b4 - (printfunc)0, /* tp_print */ - #else - (Py_ssize_t)0, /* tp_vectorcall_offset */ - #endif -- (getattrfunc) swig_varlink_getattr, /* tp_getattr */ -- (setattrfunc) swig_varlink_setattr, /* tp_setattr */ -+ (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ -+ (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ - 0, /* tp_compare */ -- (reprfunc) swig_varlink_repr, /* tp_repr */ -+ (reprfunc) SwigVarLink_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ -- (reprfunc) swig_varlink_str, /* tp_str */ -+ (reprfunc) SwigVarLink_str, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - 0, /* tp_flags */ -- varlink__doc__, /* tp_doc */ -+ SwigVarLink_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ -@@ -429,22 +429,22 @@ swig_varlink_type(void) { - type_init = 1; - if (PyType_Ready(&varlink_type) < 0) - return NULL; -- if (PyModule_AddObject(runtime_data_module, "swigvarlink", (PyObject *)&varlink_type) == 0) -+ if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) - SWIG_Py_INCREF((PyObject *)&varlink_type); - } - return &varlink_type; - #else - PyType_Slot slots[] = { -- { Py_tp_dealloc, (void *)swig_varlink_dealloc }, -- { Py_tp_repr, (void *)swig_varlink_repr }, -- { Py_tp_getattr, (void *)swig_varlink_getattr }, -- { Py_tp_setattr, (void *)swig_varlink_setattr }, -- { Py_tp_str, (void *)swig_varlink_str }, -- { Py_tp_doc, (void *)varlink__doc__ }, -+ { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, -+ { Py_tp_repr, (void *)SwigVarLink_repr }, -+ { Py_tp_getattr, (void *)SwigVarLink_getattr }, -+ { Py_tp_setattr, (void *)SwigVarLink_setattr }, -+ { Py_tp_str, (void *)SwigVarLink_str }, -+ { Py_tp_doc, (void *)SwigVarLink_doc }, - { 0, NULL } - }; - PyType_Spec spec = { -- SWIG_RUNTIME_MODULE ".swigvarlink", -+ SWIG_RUNTIME_MODULE ".SwigVarLink", - sizeof(swig_varlinkobject), - 0, - Py_TPFLAGS_DEFAULT, -@@ -452,7 +452,7 @@ swig_varlink_type(void) { - }; - PyObject *pytype = PyType_FromSpec(&spec); - PyObject *runtime_data_module = SWIG_runtime_data_module(); -- if (pytype && PyModule_AddObject(runtime_data_module, "swigvarlink", pytype) == 0) -+ if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) - SWIG_Py_INCREF(pytype); - return (PyTypeObject *)pytype; - #endif -@@ -715,7 +715,7 @@ SwigPyObject_repr(SwigPyObject *v) - } - - /* We need a version taking two PyObject* parameters so it's a valid -- * PyCFunction to use in swigobject_methods[]. */ -+ * PyCFunction to use in SwigPyObject_methods[]. */ - SWIGRUNTIME PyObject * - SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) - { -@@ -922,7 +922,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) - } - - static PyMethodDef --swigobject_methods[] = { -+SwigPyObject_methods[] = { - {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, - {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, - {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, -@@ -934,7 +934,7 @@ swigobject_methods[] = { - - SWIGRUNTIME PyTypeObject* - SwigPyObject_TypeOnce(void) { -- static char swigobject_doc[] = "Swig object holding a C/C++ pointer"; -+ static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; - #ifndef SWIG_HEAPTYPES - static PyNumberMethods SwigPyObject_as_number = { - (binaryfunc)0, /*nb_add*/ -@@ -1017,14 +1017,14 @@ SwigPyObject_TypeOnce(void) { - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ -- swigobject_doc, /* tp_doc */ -+ SwigPyObject_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ -- swigobject_methods, /* tp_methods */ -+ SwigPyObject_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ -@@ -1081,9 +1081,9 @@ SwigPyObject_TypeOnce(void) { - { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, - { Py_tp_repr, (void *)SwigPyObject_repr }, - { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, -- { Py_tp_doc, (void *)swigobject_doc }, -+ { Py_tp_doc, (void *)SwigPyObject_doc }, - { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, -- { Py_tp_methods, (void *)swigobject_methods }, -+ { Py_tp_methods, (void *)SwigPyObject_methods }, - { Py_nb_int, (void *)SwigPyObject_long }, - { 0, NULL } - }; -@@ -1207,7 +1207,7 @@ SwigPyPacked_dealloc(PyObject *v) - - SWIGRUNTIME PyTypeObject* - SwigPyPacked_TypeOnce(void) { -- static char swigpacked_doc[] = "Swig object holding a C/C++ function pointer"; -+ static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; - #ifndef SWIG_HEAPTYPES - static PyTypeObject swigpypacked_type; - static int type_init = 0; -@@ -1246,7 +1246,7 @@ SwigPyPacked_TypeOnce(void) { - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ -- swigpacked_doc, /* tp_doc */ -+ SwigPyPacked_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ -@@ -1311,7 +1311,7 @@ SwigPyPacked_TypeOnce(void) { - { Py_tp_repr, (void *)SwigPyPacked_repr }, - { Py_tp_str, (void *)SwigPyPacked_str }, - { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, -- { Py_tp_doc, (void *)swigpacked_doc }, -+ { Py_tp_doc, (void *)SwigPyPacked_doc }, - { 0, NULL } - }; - PyType_Spec spec = { --- -2.50.1 - - -From 831fc6069115b8a31bed5d0bcae221825cd43c18 Mon Sep 17 00:00:00 2001 -From: William S Fulton -Date: Tue, 13 May 2025 08:40:45 +0100 -Subject: [PATCH 4/5] Add docs on the python runtime module - ---- - Doc/Manual/Python.html | 50 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 50 insertions(+) - -diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html -index 7427ca4cf..cc82e9762 100644 ---- a/Doc/Manual/Python.html -+++ b/Doc/Manual/Python.html -@@ -1000,6 +1000,10 @@ module name, make sure you don't use the same name as a built-in - Python command or standard module name. -

- -+

-+There is also a further 'behind the scenes' Python runtime module, but this implementation detail is covered later. -+

-+ -

33.3.2 Functions

- - -@@ -2704,6 +2708,52 @@ in the file python/pyopers.swg in the SWIG library. -

- - -+

33.4.3 Python runtime module

-+ -+

-+In addition to the two Python modules that are generated by SWIG, there is also a third 'behind the scenes' Python runtime module. -+The runtime module is very much an implementation level detail, but is mentioned here for completeness and for the inquisitive! -+

-+ -+

-+SWIG implements a run-time type checker for checking a Python type/class as it passes between the Python and C/C++ layers. -+It is also used when multiple SWIG modules need to share type information with each other (when using the %import directive). -+More details can be found in the SWIG runtime code and run-time type checker sections. -+The runtime module contains the following: -+

-+ -+
    -+
  1. A Python Capsule containing a pointer to the underlying C module data structure used by the runtime type checker. For multiple modules to access the common runtime implementation. The Capsule is named type_pointer_capsule except when using -builtin when it is instead called type_pointer_capsule_builtin.
  2. -+
  3. The builtin type SwigPyObject - Swig object holding a C/C++ pointer. For 'normal' pointers, that is, not for function pointers nor member function pointers.
  4. -+
  5. The builtin type SwigPyPacked - Swig object holding a C/C++ function pointer. For C pointers to a function or C++ member function pointers.
  6. -+
  7. The builtin type SwigVarLink - Swig variable link object. The type used by the 'cvar' field for accessing C/C++ global variables.
  8. -+
-+ -+

-+If multiple SWIG modules are being used, the C/C++ wrapped proxy classes/types can be shared or used across the different modules via the SWIG runtime. -+The runtime is accessed and shared via the Capsule in the runtime module. -+The Python runtime module is implemented as a Python builtin module. While users are unlikely to use or import the runtime module directly, it can be inspected simply enough. -+The name of the module is swig_runtime_data appended with the runtime version as defined by SWIG_RUNTIME_VERSION. -+First import your SWIG generated module. Next find the exact runtime module name so you know what to import before inspecting it with say dir. -+The interpreter session below demonstrates this with a SWIG generated module called example: -+

-+ -+
-+
-+>>> import example
-+>>> import sys
-+>>> list(m for m in sys.modules if m.startswith("swig_runtime_data"))
-+['swig_runtime_data5']
-+>>> import swig_runtime_data5
-+>>> dir(swig_runtime_data5)
-+['SwigPyObject', 'SwigPyPacked', 'SwigVarLink', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'type_pointer_capsule']
-+
-+
-+ -+

-+Compatibility Note: Only the Capsule was stored in the Python runtime module prior to SWIG-4.4.0. -+

-+ -

33.4.3 Memory management

- - --- -2.50.1 - - -From d966fd3ba18370b5bf34b67ff376d88fb6d3e65b Mon Sep 17 00:00:00 2001 -From: William S Fulton -Date: Tue, 13 May 2025 21:42:56 +0100 -Subject: [PATCH 5/5] Test swig runtime module contains expected names - ---- - .../python/python_moduleimport_runme.py | 17 +++++++++++++++++ - Examples/test-suite/python_moduleimport.i | 2 ++ - 2 files changed, 19 insertions(+) - -diff --git a/Examples/test-suite/python/python_moduleimport_runme.py b/Examples/test-suite/python/python_moduleimport_runme.py -index cdb860730..8e0aa6121 100644 ---- a/Examples/test-suite/python/python_moduleimport_runme.py -+++ b/Examples/test-suite/python/python_moduleimport_runme.py -@@ -1,7 +1,24 @@ - import python_moduleimport - -+# Test custom moduleimport in %module - if python_moduleimport.simple_function(99) != 99: - raise RuntimeError("simple_function") - - if python_moduleimport.extra_import_variable != "custom import of _python_moduleimport": - raise RuntimeError("custom import") -+ -+ -+# Test the swig runtime module contains the expected names/types -+import importlib -+swig_runtime_version = python_moduleimport.runtime_version() -+swig_runtime_data = importlib.import_module("swig_runtime_data" + swig_runtime_version) # Equivalent to (for version 5): import swig_runtime_data5 as swig_runtime_data -+ -+names = dir(swig_runtime_data) -+expected_names = ("SwigPyObject", "SwigPyPacked", "SwigVarLink") -+for name in expected_names: -+ if name not in names: -+ raise RuntimeError("{} not in {}".format(name, names)) -+ -+cvar_type = type(python_moduleimport.cvar) -+if cvar_type.__name__ != "SwigVarLink": -+ raise RuntimeError("cvar type name is incorrect: {}".format(cvar_type.__name__)) -diff --git a/Examples/test-suite/python_moduleimport.i b/Examples/test-suite/python_moduleimport.i -index f62547dcd..f0d203433 100644 ---- a/Examples/test-suite/python_moduleimport.i -+++ b/Examples/test-suite/python_moduleimport.i -@@ -23,4 +23,6 @@ from $module import * - - %inline %{ - int simple_function(int i) { return i; } -+int globalvar = 99; -+const char * runtime_version() { return SWIG_RUNTIME_VERSION; } - %} --- -2.50.1 - diff --git a/swig.spec b/swig.spec index 54f3086..0b7b0f9 100644 --- a/swig.spec +++ b/swig.spec @@ -68,7 +68,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig -Version: 4.4.0 +Version: 4.4.1 Release: 1%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause URL: https://www.swig.org/ @@ -363,6 +363,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Mon Dec 08 2025 Jitka Plesnikova - 4.4.1-1 +- 4.4.1 bump (rhbz#2419819, rhbz#2415440) + * Tue Oct 21 2025 Jitka Plesnikova - 4.4.0-1 - 4.4.0 bump (rhbz#2405182)