gcc-python-plugin icon indicating copy to clipboard operation
gcc-python-plugin copied to clipboard

False refleak warning with PyObject_CallMethod and "N" argument specificier

Open davidmalcolm opened this issue 8 years ago • 1 comments

CPyChecker warns that "ob_refcnt of PyBool_FromLong is 1 too high" in code like this:

PyObject_CallMethod(obj, "methodname", "N", PyBool_FromLong(0));

In fact, the "N" specifier means that PyObject_CallMethod steals the reference if the return value of PyBool_FromLong is non-NULL.

davidmalcolm avatar Feb 09 '17 20:02 davidmalcolm

Imported from trac issue 55. Created by emptysquare on 2014-01-29T15:58:04, last modified: 2014-01-29T15:58:04

davidmalcolm avatar Feb 09 '17 20:02 davidmalcolm