[Python-Dev] Interesting paper on exception handling in C

Martin v. Loewis martin@v.loewis.de
Tue, 27 Nov 2001 00:11:42 +0100


> If something like this was implemented in the Python source, it might make
> it possible to write cleaner more leak-resistant extension modules.

Isn't P3K written in C++, anyway :-)

I don't think using setjmp and longjmp that heavily is a smart
idea. There is a significant cost to it, and the benchmarks he had are
somewhat cheating, since it performs many malloc calls for a single
setjmp call. For Python, we'd need a setjmp in every function, and
perhaps multiple setjmps (one per try-catch-block).

Of course, if we assume that there are only two true compilers (MSVC
and gcc), then we could use the built-in facilities of these compilers
for exception handling in C :-)

Regards,
Martin