[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Weird crashes with 1.5.x



Michael Hudson wrote:
> I don't know what's up here, but I'll just point out that getting
> utterly random exceptions is often a symptom of some PyCFunction
> setting an exception but returning non-NULL.
> 
> Can you try this in a debug build (of Python -- you'll probably need
> to rebuild pygame too)?  That contains checks for this sort of thing.

pygame-1.5 added the ability for any object with a "rect" attribute 
to be treated like a regular rectangle argument. i was calling the 
straight C function 'PyObject_GetAttrString'. The docs lead me to 
believe no exception would be raised on error, but that does not 
seem to be the case.

PyObject* PyObject_GetAttrString(PyObject *o, char *attr_name)
     Return value: New reference.
     Retrieve an attribute named attr_name from object o. Returns
     the attribute value on success, or NULL on failure. This is the
     equivalent of the Python expression "o.attr_name".


i've just changed the pygame code to first call 
'PyObject_HasAttrString' which will not raise any exceptions. 
chakie, can you test from cvs pygame? i assume it will work now.



____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org