PyObject_New not handled properly
Consider this source: {{{ #include <Python.h>
PyObject * create_event_object (PyTypeObject *py_type) { PyObject *event_obj;
event_obj = PyObject_New (PyObject, py_type); if (!event_obj) goto fail;
return event_obj;
fail: Py_XDECREF (event_obj); return NULL; } }}}
I think it is correct, but if I compile it with the cpython checker I get errors: {{{ newobj.c: In function ‘create_event_object’: newobj.c:17:1: warning: ob_refcnt of '*py_type' is 1 too low [enabled by default] newobj.c:17:1: note: was expecting final ob_refcnt to be N + 1 (for some unknown N) newobj.c:17:1: note: due to object being referenced by: _PyObject_New.ob_type newobj.c:17:1: note: but final ob_refcnt is N + 0 newobj.c:8:13: note: when _PyObject_New() succeeds at: event_obj = PyObject_New (PyObject, py_type); newobj.c:8:13: note: '*py_type' is now referenced by 1 non-stack value(s): _PyObject_New.ob_type newobj.c:9:6: note: taking False path at: if (!event_obj) newobj.c:12:3: note: reaching: return event_obj; newobj.c:17:1: note: returning newobj.c:5:1: note: graphical error report for function 'create_event_object' written out to 'newobj.c.create_event_object-refcount-errors.html' }}}
Imported from trac issue 45. Created by tromey on 2013-04-17T14:12:35, last modified: 2013-04-17T14:12:35