[gdal-dev] exceptions in bindings
Ari Jolma
ari.jolma at tkk.fi
Sat Jul 26 03:38:26 EDT 2008
Howard Butler kirjoitti:
>
>
> I'm not positive, but I think the rationale for this is in the Python
> case where we are using return codes rather than exceptions, the user
> needs to control the ability of when the CPL error reset happens. If
> a user were to forget to call the reset due to an error in a previous
> function call, they would get an error pertaining to the wrong
> function call. I think the CPLErrorReset calls that exist in the
> methods are to hand hold the user in this instance.
"in this instance" .. but the calls are always there
>
> Frankly, I'd love to ditch the return code idiom for Python entirely
> and have exceptions always be on, but a certain Frank has a rather
> strong say about preserving the old behavior :). It would be much
> simpler in a lot of ways, and tracebacks would have a lot more meaning
> in bug reports. I find it frustrating that we can never revisit these
> kinds of decisions (because they would cause people to have to change
> some of their own code), and we must live with them forever.
Wouldn't it be just the same to the outside world in this case if the
CPLErrorReset were also in Python case in %exception once rather than in
the wrapper (Band.i) several times? %exception is used in any case,
isn't it? I mean that to me it looks that having CPLErrorReset in Python
%exception would just make the .i files a bit simpler and in the Perl
case at least remove the duplicate call? Could this be tested by making
the change and running the Python tests?
I'm just trying to reduce the unnecessary complication in the bindings a
bit...
Ari
More information about the gdal-dev
mailing list