[Python-3000] how should we handle changes to the C API?

"Martin v. Löwis" martin at v.loewis.de
Wed Feb 14 09:17:04 CET 2007


Brett Cannon schrieb:
> It doesn't need to, it just would have been convenient and consistent.
>  It seems odd that C code can compare an exception against other
> objects that an 'except' clause won't.

If you look at the C code, you find that there are very few callers
to GivenExceptionMatches (even if you also count ExceptionMatches
callers), and they either pass a PyExc_ object (which will automatically
be permitted), or one of their own exceptions. If you were to remove
PyErr_GivenExceptionMatches, and replace it with something else
where
a) people have to change the functions in their code, and
b) have to check the return value for errors (which they can
    statically determine to never happen)
I think the authors would be unhappy about this gratuitous change.

>> The deprecation of string exceptions already happens in cmp_outcome;
>> if you check for bad base exceptions there also, you would find them
>> all, no?
> 
> It wouldn't be checked in both places, just PyErr_GivenExceptionMatches().

Please don't.

Martin



More information about the Python-3000 mailing list