For reasons I do not understand, swig 2.0.5 and higher has changed
handling of python ints and longs in some way that breaks the Python
testsuite.  This fixes it.  The testsuite.  I don't know if it fixes
the real issue, I have no idea if it's a reasonable approach.  I'm not
at all comfortable with swig.

[[[
* subversion/bindings/swig/core.i
  (python typemap: char *buffer, apr_size_t *len): Accept either a
   PyInt or a PyLong buffer length argument.  swig 2.0.5+ handles this
   differently to previous releases.
]]]
--- subversion/bindings/swig/core.i
+++ subversion/bindings/swig/core.i
@@ -351,12 +351,17 @@
 */
 #ifdef SWIGPYTHON
 %typemap(in) (char *buffer, apr_size_t *len) ($*2_type temp) {
-    if (!PyInt_Check($input)) {
+    if (PyLong_Check($input)) {
+        temp = PyLong_AsLong($input);
+    }
+    else if (PyInt_Check($input)) {
+        temp = PyInt_AsLong($input);
+    }
+    else {
         PyErr_SetString(PyExc_TypeError,
                         "expecting an integer for the buffer size");
         SWIG_fail;
     }
-    temp = PyInt_AsLong($input);
     if (temp < 0) {
         PyErr_SetString(PyExc_ValueError,
                         "buffer size must be a positive integer");

Reply via email to