resultproxy.c incompatible with python2.4

Issue #2023 resolved
Former user created an issue

lib/sqlalchemy/cextension/resultproxy.c:515

Cast to (ssizeargfunc) breaks compatibility with python2.4. Using intargfunc yields a deprecation warning in 2.5 and 2.6, but it works with 2.4.

Tested with 0.6.6 release tarball.

Comments (8)

  1. Former user Account Deleted

    (original author: ged) Changing that ssizeargfunc to intargfunc unconditionally is out of the question. However, could you try this patch? I unfortunately can't test it myself because I can't easily install python 2.4 on my machine. Hope it helps.

  2. Mike Bayer repo owner

    I'm able to build against 2.4 with the patch in place, but am unable to test. My 2.4 which is on OSX returns:

    ImportError: Failure linking new module: sqlalchemy/cresultproxy.so: Symbol not found: _PyInt_FromSsize_t Referenced from: /Users/classic/dev/sa06/build/lib.macosx-10.3-fat-2.4/sqlalchemy/cresultproxy.so

    which is likely a separate issue and appears to be OSX-related.

  3. Mike Bayer repo owner

    OK, did a fresh Python2.4 build on a linux VM, and am getting the same symbol issue after building with the patch.

    This message suggests that the function doesn't exist in 2.4 (I'm always confused why things build in this scenario)

    http://comments.gmane.org/gmane.comp.python.cuda/1760

    so I tracked down that particular source code and have created a patch that appears to work on 2.4:

    diff -r 252e3bfb3a0d18d86522e19a5fc35d0b057fceca lib/sqlalchemy/cextension/resultproxy.c
    --- a/lib/sqlalchemy/cextension/resultproxy.c   Tue Jan 18 17:23:07 2011 -0500
    +++ b/lib/sqlalchemy/cextension/resultproxy.c   Sun Jan 30 13:01:36 2011 -0500
    @@ -13,6 +13,8 @@
     #define PY_SSIZE_T_MAX INT_MAX
     #define PY_SSIZE_T_MIN INT_MIN
     typedef Py_ssize_t (*lenfunc)(PyObject *);
    +#define PyInt_FromSsize_t(x) PyInt_FromLong(x)
    +typedef intargfunc ssizeargfunc;
     #endif
    

    not sure how the original poster had this "working" on 2.4 without it.

    If you can let me know this patch is OK we can commit.

  4. Former user Account Deleted

    (original author: ged) Looks good to me but with the usual disclaimer that I didn't compile or test it.

  5. Log in to comment