swig/swig-2.0.4-support-python32.patch
Ismail Dönmez bd2b7fea26 Accepting request 84038 from home:kwk:branches:devel:tools:building
- Update to swig 2.0.4
  (see CHANGES.current for complete list)
  * [Perl] Patch #3260265 fixing overloading of non-primitive types and integers in 
    Perl 5.12 and later.
  * [Ruby] Fix %import where one of the imported files %include one of the STL include
    files such as std_vector.i.
  * [python] Additional fixes for python3.2 support.
  * [python] Fixed PyGetSetDescr for python3.2.
  * Bug 2635919: Convenience method to convert std::map to a python dict.
  * Fixed bug 1163440: vararg typemaps.
  * [Python] Applied patch #1932484: migrate PyCObject to PyCapsule.
  * [Python] Merged in the szager-python-builtin branch, adding the -builtin feature
    for python.  The -builtin option may provide a significant performance gain
    in python wrappers.  For full details and limitations, refer to Doc/Manual/Python.html.
    A small test suite designed to demonstrate the performance gain is in
    Examples/python/performance.

- Fix RHEL/Fedora build

OBS-URL: https://build.opensuse.org/request/show/84038
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/swig?expand=0&rev=23
2011-09-21 07:57:50 +00:00

68 lines
2.3 KiB
Diff

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) {