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

Re: Learning the Python API - early questions

From: Russell Yanofsky <rey4_at_columbia.edu>
Date: 2003-10-16 19:50:22 CEST

Barry Scott wrote:
> At 14-10-2003 22:36, Russell Yanofsky wrote:
>> Barry Scott wrote:
>>> Is could be fixed in the C API or the Python wrapper. If the C API
>>> converted misuse to error codes then the python would just throw
>>> python exceptions with ease.
>>
>> Generally speaking, libraries can't detect when they are being
>> misused. It's possible to check for simple cases but only if you're
>> willing to bloat the code and take effort that might be better spent
>> improving documentation and simplifiying api's so the misuse doesn't
>> happen in the first place. I am a little sympathetic to the idea,
>> though, because error messages probably make a better impression on
>> scripting language users than segfaults.
>
> There is a sort of weak design-by-contract going on with the asserts
> enforcing contract violations. For non C/C++ use those contract
> violation need to
> be errors reported under control.

If the subversion API were a normal python library, it would need to report
these types of errors. But it's not a normal python library. It already
requires users to use pools and manage their own memory. I don't think it's
too much to ask them to ask them to write correct programs in order to
prevent crashes.

> The starting point would be to
> change
> the asserts into error returning checks. The asserts could still be in
> for debug builds.

I don't think converting asserts into error codes is something that will
happen any time soon (unless it can be done with some type of preprocessor
magic).
Assertions work well in C and are more convenient to use than error codes.

>
>>> Again the RapidSVN api may make this a lot easier. I'm watching for
>>> the patch to bring RapidSVN up to 0.30.0 compatibility.
>>
>> Yeah, the RapidSVN API looks a lot less error prone. And they
>> actually mention swig on their homepage,
>> http://rapidsvn.tigris.org/svncpp.html, so it was probably designed
>> to be swigified
>
> I have a prototype that seems to work, but it needs some patches that
> I've submitted to the rapidsvn folks. It also has the crash if
> misused, but there are far fewer holes to plug.

I saw your svncpp patches browsing the rapidsvn dev list. Can you post your
swig wrapper somewhere? Do you think your work could be incorporated into
rapidsvn?

- Russ

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 16 19:57:15 2003

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.