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

Re: svn commit: r31145 - trunk/subversion/bindings/swig/python/libsvn_swig_py

From: <epg_at_google.com>
Date: Fri, 16 May 2008 12:21:38 -0700

"David James" <james_at_cs.toronto.edu> writes:

> On Fri, May 16, 2008 at 12:12 PM, <epg_at_google.com> wrote:
> >> > + Py_XDECREF(result);
> >
> > Ah, this is it. We return result as the dir_baton, so we mustn't
> > free it here.
>
> Aha. Okay, so in that case let's get rid of the DECREF and add a
> comment that dir_baton is using a borrowed reference.
>
> When does the dir_baton get finally decref'd?

I don't see where or how we could DECREF it. It seems to me that
we need to Py_DECREF here and have applications pull the same
stunt they have to pull with the auth baton foo, editor and
edit_baton, and so on: the Python application code has to hold
onto these things itself :(. Something like this (from our
swig-py test suite):

Index: ra.py
===================================================================
--- ra.py (revision 31145)
+++ ra.py (working copy)
@@ -133,6 +133,7 @@
     (editor, edit_baton) = ra.get_commit_editor3(self.ra_ctx, revprops,
                                                  commit_cb, None, False)
     try:
+ dir_batons = []
       def driver_cb(parent, path, pool):
         self.assert_(path in all_paths)
         dir_baton = file_baton = None
@@ -160,9 +161,11 @@
                                   'test_delta_driver_commit', 'foo', pool)
         if file_baton is not None:
           editor.close_file(file_baton, None, pool)
+ dir_batons.append(dir_baton)
         return dir_baton
       delta.path_driver(editor, edit_baton, -1, all_paths.keys(), driver_cb)
       editor.close_edit(edit_baton)
+ del dir_batons
     except:
       try:
         editor.abort_edit(edit_baton)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-05-16 21:22:12 CEST

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