[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Subversion SWIG patch.

From: <cmpilato_at_collab.net>
Date: 2002-09-16 22:27:33 CEST

Daniel, for reference, please check out your patch at:

Specifically, this section (which appears to be the real guts of the things):

   %typemap(arginit) apr_pool_t *pool(apr_pool_t *_global_pool) {
   SWIG_ConvertPtr(PyObject_GetItem(args, PyInt_FromLong($argnum)), (void
   **)&$1, SWIGTYPE_p_apr_pool_t, SWIG_POINTER_EXCEPTION | 0);
   _global_pool = $1;
   %typemap (in) apr_pool_t *pool "";

Now, I had all kinds of trouble trying to get that to compile. So I
made some mods (which appear to be in accordance with SWIG docs):

   %typemap(arginit) apr_pool_t *pool(apr_pool_t *_global_pool) {
       if (SWIG_ConvertPtr(PyObject_GetItem(args, PyInt_FromLong($argnum)),
                           (void **)&$1, $1_descriptor, 0) == -1) {
           return NULL;
       _global_pool = $1;
   %typemap(in) apr_pool_t *pool "";

However, whenever I try to actually use the bindings, things SEGFAULT
left and right. I managed to GDB one of those segfaults (by
temporarily inserting a sleep() into the code above and attaching to
the process), and it looks as though the pool at that context is just
garbage (0xc in my case). Questions for you:

  - Did you actually test your patch?

  - What is the SWIG_POINTER_EXCEPTION flag? I can't find any doc or
    code references to it in SWIG 1.3.12.

  - You are using the $argnum magic variable to get the argument which
    is the apr_pool_t, yes? How does that hold up in the presence of
    other typemap directives that mod the argument list? For example,
    svn_repos_open() as a C function takes 3 args, but as a python
    binding takes only two (since the svn_repos_t ** is converted to a
    return value). Will $argnum still do what you expect in those

Love, an exhausted C-Mike.

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Sep 16 22:28:56 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.