Add Patch3 to fix segfaults of Python-wrappers when generating code with -buildin -modern -modernargs-flags

This commit is contained in:
Björn Esser 2015-04-03 20:19:12 +02:00
parent 3b13efef54
commit ae5d4f653e
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,23 @@
From e06906bda0ea06f6b5fc15dfa8f55a2251a1bbef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <bjoern.esser@gmail.com>
Date: Fri, 3 Apr 2015 18:48:08 +0200
Subject: [PATCH] Python: fix using `-builtin -modern -modernargs` results in
segfaulting code (#256)
---
Source/Modules/python.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index 0e4a402..b2c429d 100644
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -2718,7 +2718,7 @@ class PYTHON:public Language {
Printf(parse_args, "if (!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,0)) SWIG_fail;\n", iname, num_fixed_arguments, tuple_arguments);
}
}
- } else {
+ } else if (tuple_arguments > 0) {
Printf(parse_args, "if(!PyArg_UnpackTuple(args,(char *)\"%s\",%d,%d", iname, num_fixed_arguments, tuple_arguments);
Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL);
}

View File

@ -32,7 +32,7 @@
Summary: Connects C/C++/Objective C to some high-level programming languages
Name: swig
Version: 3.0.5
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv3+ and BSD
URL: http://swig.sourceforge.net/
Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
@ -41,6 +41,9 @@ Source1: description.h2m
Patch1: swig207-setools.patch
# Fix the failure on arch x390 during testing
Patch2: swig-2.0.10-Fix-x390-build.patch
# Fix segfaults of Python-wrappers when generating code with
# `-buildin -modern -modernargs`. Patch is upstreamed, see patch-url.
Patch3: https://github.com/swig/swig/pull/372.patch#/swig-3.0.5_fix-python-modern-buildin.patch
BuildRequires: perl, python2-devel, pcre-devel
BuildRequires: autoconf, automake, gawk, dos2unix
@ -96,6 +99,7 @@ This package contains documentation for SWIG and useful examples
%patch1 -p1 -b .setools
%patch2 -p1 -b .x390
%patch3 -p1 -b .python
for all in CHANGES README; do
iconv -f ISO88591 -t UTF8 < $all > $all.new
@ -193,6 +197,10 @@ ln -fs ../../bin/ccache-swig %{buildroot}%{_libdir}/ccache/swig
%doc Doc Examples LICENSE LICENSE-GPL LICENSE-UNIVERSITIES COPYRIGHT
%changelog
* Fri Apr 03 2015 Björn Esser <bjoern.esser@gmail.com> - 3.0.5-4
- Add Patch3 to fix segfaults of Python-wrappers when generating
code with `-buildin -modern -modernargs`-flags
* Thu Feb 19 2015 Orion Poplawski <orion@cora.nwra.com> - 3.0.5-3
- Rebuild for gcc 5 C++11 ABI