[swig] Attempt to fix PySlice* API/ABI issues with the Python 3.2 (#666429).

Adam Tkac atkac at fedoraproject.org
Mon Jan 3 13:10:16 UTC 2011


commit 631016db6f2890aca3bbcf2b9ed9b551650f2804
Author: Adam Tkac <atkac at redhat.com>
Date:   Mon Jan 3 14:09:52 2011 +0100

    Attempt to fix PySlice* API/ABI issues with the Python 3.2 (#666429).
    
    Signed-off-by: Adam Tkac <atkac at redhat.com>

 swig.spec              |    7 ++++++-
 swig200-rh666429.patch |   45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletions(-)
---
diff --git a/swig.spec b/swig.spec
index 95d9da3..66a180b 100644
--- a/swig.spec
+++ b/swig.spec
@@ -4,13 +4,14 @@
 Summary: Connects C/C++/Objective C to some high-level programming languages
 Name: swig
 Version: 2.0.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv3+ and BSD
 Group: Development/Tools
 URL: http://swig.sourceforge.net/
 Source: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
 Patch1: swig-1.3.23-pylib.patch
 Patch2: swig200-rh623854.patch
+Patch3: swig200-rh666429.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: perl, python-devel, pcre-devel
@@ -44,6 +45,7 @@ This package contains documentation for SWIG and useful examples
 %setup -q -n swig-%{version}
 %patch1 -p1 -b .pylib
 %patch2 -p1 -b .rh623854
+%patch3 -p1 -b .rh666429
 
 # as written on https://fedoraproject.org/wiki/Packaging_talk:Perl, section 2
 # (specific req/prov filtering). Before you remove this hack make sure you don't
@@ -115,6 +117,9 @@ rm -rf %{buildroot}
 %doc Doc Examples LICENSE LICENSE-GPL LICENSE-UNIVERSITIES COPYRIGHT
 
 %changelog
+* Mon Jan 03 2011 Adam Tkac <atkac redhat com> 2.0.1-2
+- attempt to fix PySlice* API/ABI issues with the Python 3.2 (#666429)
+
 * Thu Oct 07 2010 Adam Tkac <atkac redhat com> 2.0.1-1
 - update to 2.0.1 (#640354)
 - BR pcre-devel
diff --git a/swig200-rh666429.patch b/swig200-rh666429.patch
new file mode 100644
index 0000000..8f2f12f
--- /dev/null
+++ b/swig200-rh666429.patch
@@ -0,0 +1,45 @@
+diff -up swig-2.0.1/Lib/python/pycontainer.swg.rh666429 swig-2.0.1/Lib/python/pycontainer.swg
+--- swig-2.0.1/Lib/python/pycontainer.swg.rh666429	2010-02-28 00:26:02.000000000 +0100
++++ swig-2.0.1/Lib/python/pycontainer.swg	2011-01-03 13:02:29.303515695 +0100
+@@ -631,14 +631,6 @@ namespace swig
+       return x;
+     }
+ 
+-    /* typemap for slice object support */
+-    %typemap(in) PySliceObject* {
+-      $1 = (PySliceObject *) $input;
+-    }
+-    %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) PySliceObject* {
+-      $1 = PySlice_Check($input);
+-    }
+-
+     Sequence* __getslice__(difference_type i, difference_type j) throw (std::out_of_range) {
+       return swig::getslice(self, i, j);
+     }
+@@ -660,7 +652,7 @@ namespace swig
+     /* Overloaded methods for Python 3 compatibility 
+      * (Also useful in Python 2.x)
+      */
+-    Sequence* __getitem__(PySliceObject *slice) throw (std::out_of_range) {
++    Sequence* __getitem__(PyObject *slice) throw (std::out_of_range) {
+       Py_ssize_t i, j, step;
+       if( !PySlice_Check(slice) ) {
+         SWIG_Error(SWIG_TypeError, "Slice object expected.");
+@@ -670,7 +662,7 @@ namespace swig
+       return swig::getslice(self, i, j);
+     }
+ 
+-    void __setitem__(PySliceObject *slice, const Sequence& v)
++    void __setitem__(PyObject *slice, const Sequence& v)
+       throw (std::out_of_range, std::invalid_argument) {
+       Py_ssize_t i, j, step;
+       if( !PySlice_Check(slice) ) {
+@@ -681,7 +673,7 @@ namespace swig
+       swig::setslice(self, i, j, v);
+     }
+ 
+-    void __delitem__(PySliceObject *slice)
++    void __delitem__(PyObject *slice)
+       throw (std::out_of_range) {
+       Py_ssize_t i, j, step;
+       if( !PySlice_Check(slice) ) {


More information about the scm-commits mailing list