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

Re: Proof of concept higher-level python bindings for SoC project

From: Eric Gillespie <epg_at_pretzelnet.org>
Date: 2007-04-06 21:49:24 CEST

Giovanni Bajo <rasky@develer.com> writes:

> > - Our SWIG bindings convert "svn_error_t" return codes into exceptions
>
> I personally consider this a feature. In Python, it's really Pythonic that
> errors are reported in form of exceptions. Having to look at the error code of
> each function I call is something I wouldn't expect from a Python library.

Absolutely.

> Anyway, this can be implemented very easily in ctypes, given that "restype"
> can be a callable:
>
> def check_svn_error_t(value):
> value = svn_error_t(value)
> if value == 0: # or whatever is the error code
> raise SvnError(value, ...)
> return value
>
> for f in [all functions wrapped with ctypes]:
> if f.restype == svn_error_t:
> f.restype = check_svn_error_t

Maybe you'll fix a deficiency in the current bindings in the
process. svn_error_t can be stacked, but you only get the
outermost svn_error_t in the SubversionException.

-- 
Eric Gillespie <*> epg@pretzelnet.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Apr 6 21:50:34 2007

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.