Improve fix for PySlice issue (#666429).

Signed-off-by: Adam Tkac <atkac@redhat.com>
This commit is contained in:
Adam Tkac 2011-02-16 13:18:38 +01:00
parent c737d4d25a
commit 31db18046e
2 changed files with 45 additions and 20 deletions

View File

@ -4,7 +4,7 @@
Summary: Connects C/C++/Objective C to some high-level programming languages Summary: Connects C/C++/Objective C to some high-level programming languages
Name: swig Name: swig
Version: 2.0.1 Version: 2.0.1
Release: 3%{?dist} Release: 4%{?dist}
License: GPLv3+ and BSD License: GPLv3+ and BSD
Group: Development/Tools Group: Development/Tools
URL: http://swig.sourceforge.net/ URL: http://swig.sourceforge.net/
@ -117,6 +117,9 @@ rm -rf %{buildroot}
%doc Doc Examples LICENSE LICENSE-GPL LICENSE-UNIVERSITIES COPYRIGHT %doc Doc Examples LICENSE LICENSE-GPL LICENSE-UNIVERSITIES COPYRIGHT
%changelog %changelog
* Wed Feb 16 2011 Adam Tkac <atkac redhat com> 2.0.1-4
- improve fix for PySlice issue (#666429)
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-3 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

View File

@ -1,45 +1,67 @@
diff -up swig-2.0.1/Lib/python/pycontainer.swg.rh666429 swig-2.0.1/Lib/python/pycontainer.swg 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.rh666429 2011-02-16 12:25:19.277091696 +0100
+++ swig-2.0.1/Lib/python/pycontainer.swg 2011-01-03 13:02:29.303515695 +0100 +++ swig-2.0.1/Lib/python/pycontainer.swg 2011-02-16 12:48:43.273926091 +0100
@@ -631,14 +631,6 @@ namespace swig @@ -631,6 +631,7 @@ namespace swig
return x; return x;
} }
- /* typemap for slice object support */ +#if !NO_PYSLICE
- %typemap(in) PySliceObject* { /* typemap for slice object support */
- $1 = (PySliceObject *) $input; %typemap(in) PySliceObject* {
- } $1 = (PySliceObject *) $input;
- %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) PySliceObject* { @@ -638,6 +639,7 @@ namespace swig
- $1 = PySlice_Check($input); %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) PySliceObject* {
- } $1 = PySlice_Check($input);
- }
+#endif
Sequence* __getslice__(difference_type i, difference_type j) throw (std::out_of_range) { Sequence* __getslice__(difference_type i, difference_type j) throw (std::out_of_range) {
return swig::getslice(self, i, j); return swig::getslice(self, i, j);
} @@ -660,7 +662,11 @@ namespace swig
@@ -660,7 +652,7 @@ namespace swig
/* Overloaded methods for Python 3 compatibility /* Overloaded methods for Python 3 compatibility
* (Also useful in Python 2.x) * (Also useful in Python 2.x)
*/ */
- Sequence* __getitem__(PySliceObject *slice) throw (std::out_of_range) { +#if NO_PYSLICE
+ Sequence* __getitem__(PyObject *slice) throw (std::out_of_range) { + Sequence* __getitem__(PyObject *slice) throw (std::out_of_range) {
+#else
Sequence* __getitem__(PySliceObject *slice) throw (std::out_of_range) {
+#endif
Py_ssize_t i, j, step; Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) { if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected."); SWIG_Error(SWIG_TypeError, "Slice object expected.");
@@ -670,7 +662,7 @@ namespace swig @@ -669,8 +675,11 @@ namespace swig
PySlice_GetIndices(slice, self->size(), &i, &j, &step);
return swig::getslice(self, i, j); return swig::getslice(self, i, j);
} }
-
- void __setitem__(PySliceObject *slice, const Sequence& v) +#if NO_PYSLICE
+ void __setitem__(PyObject *slice, const Sequence& v) + void __setitem__(PyObject *slice, const Sequence& v)
+#else
void __setitem__(PySliceObject *slice, const Sequence& v)
+#endif
throw (std::out_of_range, std::invalid_argument) { throw (std::out_of_range, std::invalid_argument) {
Py_ssize_t i, j, step; Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) { if( !PySlice_Check(slice) ) {
@@ -681,7 +673,7 @@ namespace swig @@ -681,7 +690,11 @@ namespace swig
swig::setslice(self, i, j, v); swig::setslice(self, i, j, v);
} }
- void __delitem__(PySliceObject *slice) +#if NO_PYSLICE
+ void __delitem__(PyObject *slice) + void __delitem__(PyObject *slice)
+#else
void __delitem__(PySliceObject *slice)
+#endif
throw (std::out_of_range) { throw (std::out_of_range) {
Py_ssize_t i, j, step; Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) { if( !PySlice_Check(slice) ) {
diff -up swig-2.0.1/Source/Modules/python.cxx.rh666429 swig-2.0.1/Source/Modules/python.cxx
--- swig-2.0.1/Source/Modules/python.cxx.rh666429 2011-02-16 12:20:37.557740471 +0100
+++ swig-2.0.1/Source/Modules/python.cxx 2011-02-16 12:46:29.034224445 +0100
@@ -440,6 +440,7 @@ public:
if (py3) {
/* force disable features that not compatible with Python 3.x */
classic = 0;
+ Preprocessor_define((DOH *) "NO_PYSLICE 1", 0);
}
if (cppcast) {