swig/swig-2.0.4-support-python32.patch

68 lines
2.3 KiB
Diff
Raw Normal View History

diff -wruN -x '*~' ../orig-swig-2.0.4/Lib/python/pycontainer.swg ./Lib/python/pycontainer.swg
--- ../orig-swig-2.0.4/Lib/python/pycontainer.swg 2011-04-10 00:07:22.000000000 +0200
+++ ./Lib/python/pycontainer.swg 2011-09-20 11:27:19.000000000 +0200
@@ -657,6 +657,7 @@
return x;
}
+#if !NO_PYSLICE
/* typemap for slice object support */
%typemap(in) PySliceObject* {
if (!PySlice_Check($input)) {
@@ -667,6 +668,7 @@
%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) {
return swig::getslice(self, i, j);
@@ -689,7 +691,11 @@
/* Overloaded methods for Python 3 compatibility
* (Also useful in Python 2.x)
*/
+#if NO_PYSLICE
+ 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;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
@@ -698,8 +704,11 @@
PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
return swig::getslice(self, i, j);
}
-
+#if NO_PYSLICE
+ void __setitem__(PyObject *slice, const Sequence& v)
+#else
void __setitem__(PySliceObject *slice, const Sequence& v)
+#endif
throw (std::out_of_range, std::invalid_argument) {
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
@@ -721,7 +730,11 @@
swig::delslice(self, i,j);
}
+#if NO_PYSLICE
+ void __delitem__(PyObject *slice)
+#else
void __delitem__(PySliceObject *slice)
+#endif
throw (std::out_of_range) {
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
diff -wruN -x '*~' ../orig-swig-2.0.4/Source/Modules/python.cxx ./Source/Modules/python.cxx
--- ../orig-swig-2.0.4/Source/Modules/python.cxx 2011-05-20 07:58:05.000000000 +0200
+++ ./Source/Modules/python.cxx 2011-09-20 11:27:19.000000000 +0200
@@ -527,6 +527,7 @@
if (py3) {
/* force disable features that not compatible with Python 3.x */
classic = 0;
+ Preprocessor_define((DOH *) "NO_PYSLICE 1", 0);
}
if (cppcast) {