Re: Generating exceptions from C

2006-03-18 Thread Jacob Kroon
Just wrote: >>Does the comments above make sense? >> >> > >Not quite: when raising an exception, an instance of the exception class >_is_ created. Just like this: > > raise SomeException(msg) > >With the old (deprecated) spelling the instantiation is done implicitly: > > raise SomeExcepti

Re: Generating exceptions from C

2006-03-18 Thread Just
In article <[EMAIL PROTECTED]>, Jacob Kroon <[EMAIL PROTECTED]> wrote: > I'll just reply to myself what I've found out so far: > > > 1. PyErr_NewException() creates the exception _class_, not the > > instance right ? > > > Looks like it does yes. It doesn't even seem right to talk about an > _

Re: Generating exceptions from C

2006-03-18 Thread Jacob Kroon
I'll just reply to myself what I've found out so far: > 1. PyErr_NewException() creates the exception _class_, not the > instance right ? > Looks like it does yes. It doesn't even seem right to talk about an _instance_ of an exception... > 2. Is PyErr_SetString() the correct way to raise except

Generating exceptions from C

2006-03-18 Thread Jacob Kroon
Hi, I'm working on a python module written in C, and I'm trying to figure out how to raise python exceptions if a function fails. So far I've read http://docs.python.org/ext/errors.html and http://docs.python.org/api/exceptionHandling.html , but I've not fully understood it. I've managed to c