Exception Handling (C - extending python)

Lee lchaplin13 at gmail.com
Sun Oct 23 17:43:19 EDT 2011


For a moment, back to the basics...

I am using the example provided by docs at 2.1.2
"Providing finer control...". Using say:

mynoddy = noddy2.Noddy()
mynoddy.first = "a"
mynoddy.last = 0

the last line causes an ugly crash (on python 2.6.5 on winxp).
No way to catch the exception.

As I understand from the docs, all PyErr_SetString does is to set an
exception,
what one has to do to raise this exception (in C)?

If I replace "return -1" in the Noddy_setlast() function with "return
NULL"
(well, the compiler will complain...) the program passes by without
raising an exception.

Any explanations?...

Lee



More information about the Python-list mailing list