Is it possible to raise an exception in the initmodule function of a C extension?

Martin von Loewis loewis at informatik.hu-berlin.de
Wed Aug 23 10:06:45 EDT 2000


Alex <cut_me_out at hotmail.com> writes:

> Is there some way to turn the asserts into python exceptions?  It
> doesn't really matter in this case because the assertions are never
> going to fail (haha); I'm just a little curious.

Sure. Just set an exception, and leave the initialisation. Python will
check with PyErr_Occurred.

Regards,
Martin




More information about the Python-list mailing list