That looks fine. There are likely a couple other ways to do it more
generically (my Pay API Fu is rusty), but that code should be okay. We can
investigate more if we run into further problems.
Cheers,
-g
On Jun 17, 2012 5:24 PM, "Peter Samuelson" <peter_at_p12n.org> wrote:
>
> 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");
>
Received on 2012-06-17 17:42:20 CEST