PyObject sanitizer (CPython 2.4.4)

sndive at gmail.com sndive at gmail.com
Tue Nov 6 17:14:57 EST 2007


I get this from valgrind (no suppression file but thgis probably is
not covered by the suppressor anyway):
==6108== Invalid read of size 4
==6108==    at 0x48D19F4: lookdict_string (dictobject.c:359)
==6108==    by 0x48D1B59: PyDict_GetItem (dictobject.c:554)
==6108==    by 0x48B1657: instance_getattr2 (classobject.c:741)
==6108==    by 0x48B701D: instance_getattr1 (classobject.c:725)
==6108==    by 0x48B2670: instance_getattr (classobject.c:764)
==6108==    by 0x48D6500: PyObject_GetAttr (object.c:1088)
==6108==    by 0x48D6355: PyObject_GetAttrString (object.c:1031)

so i wonder if the PyObject i gave to PyObject_GetAttrString to gnaw
on is in good shape.
is assert(obj->ob_refcnt>0); a good way to check if i'm dealing with a
valid PyObject
or there is a helper that can do this for me?




More information about the Python-list mailing list