From 13bd2333c51c471649be7d46b043d2bbeeda7178 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Tue, 9 Jul 2024 18:38:37 +0200 Subject: [PATCH] Resolves: RHEL-32325 - 4.2.1 bump - Fix gcc's -Wformat-security warning in R Raise function - OCaml 5.2.0 ppc64le fix - Add support for Python 3.13 --- .gitignore | 1 + sources | 2 +- ...ndling-friend-constructor-destructor.patch | 105 ---------------- swig-Friends-testcase-fix.patch | 30 ----- ...n-fix-add-in-missing-SwigPyIterator_.patch | 39 ------ ...t-security-warning-in-R-Raise-functi.patch | 27 ++++ swig-Ruby-Adjust-external-runtime-fix.patch | 108 ---------------- ...Ruby-Tcl-Fix-external-runtime-output.patch | 90 ------------- ...ng-deprecated-API-in-doxygen-example.patch | 29 +++++ ...stem.runFinalization-removal-warning.patch | 118 ++++++++++++++++++ swig-ocaml-5.0.patch | 43 ------- ...3.13-deprecates-PyWeakref_GET_OBJECT.patch | 27 ++++ ...-Python-3.13-strips-docstring-indent.patch | 34 +++++ swig.spec | 42 ++++--- 14 files changed, 260 insertions(+), 435 deletions(-) delete mode 100644 swig-Fix-seg-fault-handling-friend-constructor-destructor.patch delete mode 100644 swig-Friends-testcase-fix.patch delete mode 100644 swig-Python-Regression-fix-add-in-missing-SwigPyIterator_.patch create mode 100644 swig-R-Fix-gcc-s-Wformat-security-warning-in-R-Raise-functi.patch delete mode 100644 swig-Ruby-Adjust-external-runtime-fix.patch delete mode 100644 swig-Ruby-Tcl-Fix-external-runtime-output.patch create mode 100644 swig-java-Avoid-using-deprecated-API-in-doxygen-example.patch create mode 100644 swig-java-Suppress-System.runFinalization-removal-warning.patch delete mode 100644 swig-ocaml-5.0.patch 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/.gitignore b/.gitignore index d3d48ad..3a819d9 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ swig-2.0.0.tar.gz /swig-4.1.0.tar.gz /swig-4.1.1.tar.gz /swig-4.2.0.tar.gz +/swig-4.2.1.tar.gz diff --git a/sources b/sources index 6c6bc19..e92004d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (swig-4.2.0.tar.gz) = b7f508b25bc6e882ed6123f6c7ad12b02a7b74de09ac6e5789968e9c2f51407d1e3dafd5ea495087b4fb0f447ecce17e6070471479c67c4265166d8342a10862 +SHA512 (swig-4.2.1.tar.gz) = 019dee5a46d57e1030eef47cd5d007ccaadbdcd4e53cd30d7c795f0118ecf4406a78185534502c81c5f6d7bac0713256e7e19b20b5a2d14e2c552219edbaf5cf diff --git a/swig-Fix-seg-fault-handling-friend-constructor-destructor.patch b/swig-Fix-seg-fault-handling-friend-constructor-destructor.patch deleted file mode 100644 index 2ebc211..0000000 --- a/swig-Fix-seg-fault-handling-friend-constructor-destructor.patch +++ /dev/null @@ -1,105 +0,0 @@ -From c7ab6a01c6582b92db9328e2f3daa67081f05f6e Mon Sep 17 00:00:00 2001 -From: William S Fulton -Date: Fri, 12 Jan 2024 08:45:26 +0000 -Subject: [PATCH] Fix seg fault handling friend constructor/destructor - declarations - -Closes #2749 ---- - CHANGES.current | 3 ++ - Examples/test-suite/friends.i | 34 +++++++++++++++++++++++ - Examples/test-suite/php/friends_runme.php | 2 +- - Source/CParse/parser.y | 5 +++- - 4 files changed, 42 insertions(+), 2 deletions(-) - -#diff --git a/CHANGES.current b/CHANGES.current -#index 030aa0b19..f235d9a09 100644 -#--- a/CHANGES.current -#+++ b/CHANGES.current -#@@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ -# Version 4.2.1 (in progress) -# =========================== -# -#+2024-01-12: wsfulton -#+ #2749 Fix seg fault handling friend constructor/destructor declarations. -#+ -# 2024-01-12: olly -# [Ruby,Tcl] #2751 Fix -external-runtime output to define -# SWIG_snprintf (bug introduced in 4.2.0). -diff --git a/Examples/test-suite/friends.i b/Examples/test-suite/friends.i -index a2a5151e0..879f3b3bc 100644 ---- a/Examples/test-suite/friends.i -+++ b/Examples/test-suite/friends.i -@@ -148,6 +148,40 @@ - } - } - -+%inline %{ -+ class CModelParameterSpecies; -+ class CModelParameterCompartment { -+ CModelParameterSpecies *species; -+ public: -+ int getSpeciesVal(); -+ CModelParameterCompartment(); -+ ~CModelParameterCompartment(); -+ }; -+ class CModelParameterSpecies -+ { -+ int private_val; -+ public: -+ // Friend function-declarations are silently ignored (including constructor and destructor declarations) -+ friend CModelParameterCompartment::~CModelParameterCompartment(); -+ friend CModelParameterCompartment::CModelParameterCompartment(); -+ friend int CModelParameterCompartment::getSpeciesVal(); -+ }; -+%} -+ -+%{ -+CModelParameterCompartment::~CModelParameterCompartment() { -+ species = new CModelParameterSpecies(); -+ species->private_val = 1; -+} -+CModelParameterCompartment::CModelParameterCompartment() { -+ species->private_val = 0; -+ delete species; -+} -+int CModelParameterCompartment::getSpeciesVal() { -+ return species->private_val; -+} -+%} -+ - // Use this version with extra qualifiers to test SWIG as some compilers accept this - namespace ns1 { - namespace ns2 { -diff --git a/Examples/test-suite/php/friends_runme.php b/Examples/test-suite/php/friends_runme.php -index f0ef5df58..2e5d3b1fd 100644 ---- a/Examples/test-suite/php/friends_runme.php -+++ b/Examples/test-suite/php/friends_runme.php -@@ -3,7 +3,7 @@ - require "tests.php"; - - check::functions(array('globalscope','mix','get_val2','get_val3','bas','baz','bar','get_val1','set')); --check::classes(array('friends','Foo','A','B','D_i','D_d')); -+check::classes(array('friends','Foo','A','B','D_i','D_d','CModelParameterCompartment','CModelParameterSpecies')); - // No new vars - check::globals(array()); - -diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y -index e5a79f128..edf38c360 100644 ---- a/Source/CParse/parser.y -+++ b/Source/CParse/parser.y -@@ -4732,7 +4732,10 @@ cpp_member : cpp_member_no_dox - */ - - cpp_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end { -- if (inclass || extendmode) { -+ /* Cannot be a constructor declaration/definition if parsed as a friend destructor/constructor -+ or a badly declared friend function without return type */ -+ int isfriend = Strstr($1, "friend") != NULL; -+ if (!isfriend && (inclass || extendmode)) { - String *name = SwigType_templateprefix($2); /* A constructor can optionally be declared with template parameters before C++20, strip these off */ - SwigType *decl = NewStringEmpty(); - $$ = new_node("constructor"); --- -2.43.0 - diff --git a/swig-Friends-testcase-fix.patch b/swig-Friends-testcase-fix.patch deleted file mode 100644 index 7862c55..0000000 --- a/swig-Friends-testcase-fix.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 2d39d558734cd49b960410c8894b76aa59af60cc Mon Sep 17 00:00:00 2001 -From: William S Fulton -Date: Tue, 16 Jan 2024 08:24:46 +0000 -Subject: [PATCH] Friends testcase fix - ---- - Examples/test-suite/friends.i | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Examples/test-suite/friends.i b/Examples/test-suite/friends.i -index e37a8c11f..0efffd1cb 100644 ---- a/Examples/test-suite/friends.i -+++ b/Examples/test-suite/friends.i -@@ -166,11 +166,11 @@ - %} - - %{ --CModelParameterCompartment::~CModelParameterCompartment() { -+CModelParameterCompartment::CModelParameterCompartment() { - species = new CModelParameterSpecies(); - species->private_val = 1; - } --CModelParameterCompartment::CModelParameterCompartment() { -+CModelParameterCompartment::~CModelParameterCompartment() { - species->private_val = 0; - delete species; - } --- -2.43.0 - diff --git a/swig-Python-Regression-fix-add-in-missing-SwigPyIterator_.patch b/swig-Python-Regression-fix-add-in-missing-SwigPyIterator_.patch deleted file mode 100644 index 8b286ab..0000000 --- a/swig-Python-Regression-fix-add-in-missing-SwigPyIterator_.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 95140fa417a4350e2a0ff51c6933667199949442 Mon Sep 17 00:00:00 2001 -From: William S Fulton -Date: Mon, 8 Jan 2024 19:31:49 +0000 -Subject: [PATCH] Python Regression fix - add in missing SwigPyIterator_T - fragment - -Closes #2744 ---- - CHANGES.current | 3 +++ - Lib/python/std_map.i | 2 +- - 2 files changed, 4 insertions(+), 1 deletion(-) - -#diff --git a/CHANGES.current b/CHANGES.current -#index b88b2f563..c925cdda5 100644 -#--- a/CHANGES.current -#+++ b/CHANGES.current -#@@ -7,3 +7,6 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ -# Version 4.2.1 (in progress) -# =========================== -# -#+2024-01-06: wsfulton -#+ [Python] #2744 Regression fix - add in missing SwigPyIterator_T fragment for -#+ SwigPyIteratorClosed_T when using %import on an instantiated std::map. -diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i -index 3f8f3b06b..954e7eb2d 100644 ---- a/Lib/python/std_map.i -+++ b/Lib/python/std_map.i -@@ -2,7 +2,7 @@ - Maps - */ - --%fragment("StdMapCommonTraits","header",fragment="StdSequenceTraits") -+%fragment("StdMapCommonTraits","header",fragment="StdSequenceTraits",fragment="SwigPyIterator_T") - { - namespace swig { - template --- -2.43.0 - 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-Ruby-Adjust-external-runtime-fix.patch b/swig-Ruby-Adjust-external-runtime-fix.patch deleted file mode 100644 index 0e7fc67..0000000 --- a/swig-Ruby-Adjust-external-runtime-fix.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 84a2c45d66f0334f8fe67077311383af11a2d5c8 Mon Sep 17 00:00:00 2001 -From: Olly Betts -Date: Fri, 12 Jan 2024 16:15:31 +1300 -Subject: [PATCH] Adjust -external-runtime fix - -The original fix broke C#, D and Java which don't seem to include -swigrun.swg, so split out the SWIG_snprintf macros into a new file -and explicitly include it for the external runtime. - -See #2751. ---- - Lib/swig.swg | 2 ++ - Lib/swigcompat.swg | 23 +++++++++++++++++++++++ - Lib/swigrun.swg | 17 ----------------- - Source/Modules/main.cxx | 9 +++++++++ - 4 files changed, 34 insertions(+), 17 deletions(-) - create mode 100644 Lib/swigcompat.swg - -diff --git a/Lib/swig.swg b/Lib/swig.swg -index faa75baa9..db7e08cf6 100644 ---- a/Lib/swig.swg -+++ b/Lib/swig.swg -@@ -710,3 +710,5 @@ template T SwigValueInit() { - #endif - %} - #endif -+ -+%insert("runtime") "swigcompat.swg" -diff --git a/Lib/swigcompat.swg b/Lib/swigcompat.swg -new file mode 100644 -index 000000000..7d29b7539 ---- /dev/null -+++ b/Lib/swigcompat.swg -@@ -0,0 +1,23 @@ -+/* ----------------------------------------------------------------------------- -+ * swigcompat.swg -+ * -+ * Macros to provide support compatibility with older C and C++ standards. -+ * ----------------------------------------------------------------------------- */ -+ -+/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF -+ * if you're missing it. -+ */ -+#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ -+ (defined __cplusplus && __cplusplus >= 201103L) || \ -+ defined SWIG_HAVE_SNPRINTF) && \ -+ !defined SWIG_NO_SNPRINTF -+# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) -+# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) -+#else -+/* Fallback versions ignore the buffer size, but most of our uses either have a -+ * fixed maximum possible size or dynamically allocate a buffer that's large -+ * enough. -+ */ -+# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) -+# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) -+#endif -diff --git a/Lib/swigrun.swg b/Lib/swigrun.swg -index 80e41bb50..824185c02 100644 ---- a/Lib/swigrun.swg -+++ b/Lib/swigrun.swg -@@ -181,23 +181,6 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { - # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) - #endif - --/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF -- * if you're missing it. -- */ --#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ -- (defined __cplusplus && __cplusplus >= 201103L) || \ -- defined SWIG_HAVE_SNPRINTF) && \ -- !defined SWIG_NO_SNPRINTF --# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) --# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) --#else --/* Fallback versions ignore the buffer size, but most of our uses either have a -- * fixed maximum possible size or dynamically allocate a buffer that's large -- * enough. -- */ --# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) --# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) --#endif - - #include - -diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx -index 8a44921ad..76b4f9d28 100644 ---- a/Source/Modules/main.cxx -+++ b/Source/Modules/main.cxx -@@ -379,6 +379,15 @@ static void SWIG_dump_runtime() { - Swig_banner(runtime); - Printf(runtime, "\n"); - -+ s = Swig_include_sys("swigcompat.swg"); -+ if (!s) { -+ Printf(stderr, "*** Unable to open 'swigcompat.swg'\n"); -+ Delete(runtime); -+ Exit(EXIT_FAILURE); -+ } -+ Printf(runtime, "%s", s); -+ Delete(s); -+ - s = Swig_include_sys("swiglabels.swg"); - if (!s) { - Printf(stderr, "*** Unable to open 'swiglabels.swg'\n"); --- -2.43.0 - diff --git a/swig-Ruby-Tcl-Fix-external-runtime-output.patch b/swig-Ruby-Tcl-Fix-external-runtime-output.patch deleted file mode 100644 index 7edaa44..0000000 --- a/swig-Ruby-Tcl-Fix-external-runtime-output.patch +++ /dev/null @@ -1,90 +0,0 @@ -From db50dc8154c5c63593e80c5cc5f96d6303dd0214 Mon Sep 17 00:00:00 2001 -From: Olly Betts -Date: Fri, 12 Jan 2024 14:08:35 +1300 -Subject: [PATCH] [Ruby,Tcl] Fix -external-runtime output - -Fix -external-runtime output to define SWIG_snprintf (bug introduced in -4.2.0). - -Fixes #2751 ---- - CHANGES.current | 4 ++++ - Lib/swig.swg | 21 --------------------- - Lib/swigrun.swg | 17 +++++++++++++++++ - 3 files changed, 21 insertions(+), 21 deletions(-) - -#diff --git a/CHANGES.current b/CHANGES.current -#index fefa0f942..8d68a9687 100644 -#--- a/CHANGES.current -#+++ b/CHANGES.current -#@@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ -# Version 4.2.1 (in progress) -# =========================== -# -#+2024-01-12: olly -#+ [Ruby,Tcl] #2751 Fix -external-runtime output to define -#+ SWIG_snprintf (bug introduced in 4.2.0). -#+ -# 2024-01-12: olly -# Improve preprocessor warning for use of an undefined function-like -# macro. SWIG now warns: -diff --git a/Lib/swig.swg b/Lib/swig.swg -index ce5163685..faa75baa9 100644 ---- a/Lib/swig.swg -+++ b/Lib/swig.swg -@@ -710,24 +710,3 @@ template T SwigValueInit() { - #endif - %} - #endif -- --%insert("runtime") %{ --/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF -- * if you're missing it. -- */ --#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ -- (defined __cplusplus && __cplusplus >= 201103L) || \ -- defined SWIG_HAVE_SNPRINTF) && \ -- !defined SWIG_NO_SNPRINTF --# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) --# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) --#else --/* Fallback versions ignore the buffer size, but most of our uses either have a -- * fixed maximum possible size or dynamically allocate a buffer that's large -- * enough. -- */ --# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) --# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) --#endif -- --%} -diff --git a/Lib/swigrun.swg b/Lib/swigrun.swg -index 824185c02..80e41bb50 100644 ---- a/Lib/swigrun.swg -+++ b/Lib/swigrun.swg -@@ -181,6 +181,23 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { - # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) - #endif - -+/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF -+ * if you're missing it. -+ */ -+#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ -+ (defined __cplusplus && __cplusplus >= 201103L) || \ -+ defined SWIG_HAVE_SNPRINTF) && \ -+ !defined SWIG_NO_SNPRINTF -+# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) -+# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) -+#else -+/* Fallback versions ignore the buffer size, but most of our uses either have a -+ * fixed maximum possible size or dynamically allocate a buffer that's large -+ * enough. -+ */ -+# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) -+# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) -+#endif - - #include - --- -2.43.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 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-ocaml-5.0.patch b/swig-ocaml-5.0.patch deleted file mode 100644 index 820921a..0000000 --- a/swig-ocaml-5.0.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- swig-4.1.1/Lib/ocaml/ocamlrundec.swg.orig 2022-11-30 00:35:05.000000000 -0700 -+++ swig-4.1.1/Lib/ocaml/ocamlrundec.swg 2023-07-04 07:09:10.733716151 -0600 -@@ -14,7 +14,7 @@ SWIGEXT { - #else - #define SWIGEXT - #endif --#define value caml_value_t -+#define caml_value_t value - #define CAML_VALUE caml_value_t - #define CAML_NAME_SPACE - #include -@@ -80,11 +80,15 @@ SWIGEXT { - /* Also an l-value. */ - #endif - -+#ifndef CAML_LOCAL_ROOTS -+#define CAML_LOCAL_ROOTS caml_local_roots -+#endif -+ - #ifdef CAMLreturn0 - #undef CAMLreturn0 - #endif - #define CAMLreturn0 do{ \ -- caml_local_roots = caml__frame; \ -+ CAML_LOCAL_ROOTS = caml__frame; \ - return; \ - }while (0) - -@@ -93,12 +97,12 @@ SWIGEXT { - #endif - #define CAMLreturn(result) do{ \ - caml_value_t caml__temp_result = (result); \ -- caml_local_roots = caml__frame; \ -+ CAML_LOCAL_ROOTS = caml__frame; \ - return (caml__temp_result); \ - }while(0) - - #define CAMLreturn_type(result) do{ \ -- caml_local_roots = caml__frame; \ -+ CAML_LOCAL_ROOTS = caml__frame; \ - return result; \ - }while(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 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 7d9062a..e14d765 100644 --- a/swig.spec +++ b/swig.spec @@ -19,9 +19,9 @@ %{!?tcl:%global tcl 1} %{!?lualang:%global lualang 1} %{!?perllang:%global perllang 1} -%{!?phplang:%global phplang 1} %{!?rubylang:%global rubylang 1} %{!?python3lang:%global python3lang 1} +%{!?phplang:%global phplang 1} # OCaml packages not built on i686 since OCaml 5 / Fedora 39. %ifarch %{ix86} %{!?ocamllang:%global ocamllang 0} @@ -42,10 +42,12 @@ %bcond_without build_ccache_swig %endif -%ifarch i686 +%ifarch %{ix86} %{!?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 @@ -57,8 +59,8 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig -Version: 4.2.0 -Release: 2%{?dist} +Version: 4.2.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 @@ -69,20 +71,15 @@ Source2: description-ccache.h2m Source3: ccache-swig.sh Source4: ccache-swig.csh %endif -# OCaml 5.0 support -# https://github.com/swig/swig/pull/2649 -Patch0: swig-ocaml-5.0.patch -# Fix missing fragment dependency, in upstream since 4.2.1 -# https://github.com/swig/swig/pull/2744 -Patch1: swig-Python-Regression-fix-add-in-missing-SwigPyIterator_.patch -# Fix -external-runtime output, in upstream since 4.2.1 -# https://github.com/swig/swig/pull/2751 -Patch2: swig-Ruby-Tcl-Fix-external-runtime-output.patch -Patch3: swig-Ruby-Adjust-external-runtime-fix.patch -# Fix seg fault handling friend constructor/destructor declarations -# https://github.com/swig/swig/issues/2749 -Patch4: swig-Fix-seg-fault-handling-friend-constructor-destructor.patch -Patch5: swig-Friends-testcase-fix.patch +# 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 @@ -366,6 +363,13 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Tue Jul 02 2024 Jitka Plesnikova - 4.2.1-1 +- Resolves: RHEL-32325 +- 4.2.1 bump +- Fix gcc's -Wformat-security warning in R Raise function +- OCaml 5.2.0 ppc64le fix +- Add support for Python 3.13 + * Mon Jun 24 2024 Troy Dawson - 4.2.0-2 - Bump release for June 2024 mass rebuild