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

Re: SoC application submitted: Improving the Python Bindings

From: Walter Mundt <emage_at_spamcop.net>
Date: 2006-05-08 21:35:51 CEST

David James wrote:
>> Deliverables, in approximate order of implementation:
>> * Patch to work around inability to set baton/callback pairs in
>> Python. This may be a bit messy, but the idea is to wrap all
>> uses of the SWIG-level Python interface when coding up the
>> pure-Python usability-enhancement layer.
> Could you explain how this works? (No need to update your proposal
> with this info -- just send it to the mailing list)

Well, here's my idea: you can provide access to opaque function pointers
to Python in SWIG. Python can't _call_ those, but it can set them on
objects. For each callback type, I would write a C callback in the
bindings supplement library that expects a callable PyObject * in the
baton, which it calls with the relevant parameters. Also, need a
function that takes a PyObject and returns a void * address thereof,
which should make the swig bindings not complain when setting the baton
to the Python callable.

Then, the Python layer would have something like this:
def set_foo_function(pyfunc):
     _ctx.foo_function = FOO_PYOBJECT_CALLBACK_PTR
     self.foo_baton = pyfunc # keep a reference alive because the
                             # following can't track refs correctly
     _ctx.foo_baton = make_pyobj_baton(pyfunc)

Sound reasonable?

> If you can write rock solid, well-tested, Pythonic, object-oriented
> and fully documented bindings for just the first of those five
> libraries, I'll be as happy as can be. If you can deliver all five,
> you'll be our hero.
I probably can't, but I intend to try; that's why the prioritized list!
  That's also why the comment on completion vs. testedness. I do intend
to test basic functionality as I go, but going for full-coverage testing
would make completing the bindings totally impossible.

> Walter, could you update your proposal with specific dates (and time
> estimates, in hours) for each of your objectives? I understand it's
> hard to predict progress before you get started, but it'd rock if we
> had some ballpark estimates so that we can measure our progress.
I'll try and put something together tonight. I'm a bit busy now or I'd
include the info in-line.

> In any case, I'll be happy to mentor your application, and I'll notate
> as such on code.google.com.


To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon May 8 21:37:40 2006

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