Exceptions and Python/C API

By Ulisses Furquim

You can do a lot of good stuff with the Python/C API. However, bear in mind that Python has exceptions and so you have to deal with them even when you’re using its C API. If you’re using the Python/C API and forget to check and handle exceptions I can say your program will probably crash with some weird exception at some weird place (believe me, been there). And what it’s worse: it won’t be easy to find where is the problem! (you can find how to do exception handling with Python/C API here).

Leave a Reply