[PyKDE] Runtime Error

Phil Thompson phil at riverbankcomputing.co.uk
Thu Jul 1 14:36:01 BST 2004


On Thursday 01 July 2004 12:41 pm, Toby Dickenson wrote:
> On Thursday 01 July 2004 12:07, you wrote:
> > On Thursday 01 July 2004 11:43 am, Toby Dickenson wrote:
> > > In sip 3.8 and PyQt 3.8.1....
> > >
> > > >>> qt.QStyleFactory.create('style that does not exist')
> > >
> > > Traceback (most recent call last):
> > >   File "<stdin>", line 1, in ?
> > > RuntimeError: Attempt to create a Python instance for a NULL pointer
> > >
> > > Bug, or just a curious interface?
> >
> > Or an accurate error message.
>
> Could be that too, yes.
>
> > Any suggestion as to what would seem more
> > natural?
>
> RuntimeError is normally used to communicate a program logic abnormality.
> It conveys similar information to an ASSERT, although in a different
> manner.
>
> This Qt method returning NULL is perfectly normal (although the qt
> documentation doesnt state that :-(. The nature of the error is different
> to "Underlying C/C++ object has been deleted", so RuntimeError felt
> suprising.
>
> I anticipated either a return value of None, or an exception derived from
> ValueError (indicating that the value of the style name is wrong).

Hmm - returning None would be more consistent with NULL handling elsewhere. 
There is also an internal inconsistency which I hadn't noticed before.

Ok, I'm convinced. The change will be in tonight's snapshots.

Phil




More information about the PyQt mailing list