tools/python/pyxl: Fix reference counting of Py_(None|True|False)

The incorrect refcounting causes the python interpreter to crash

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Gianni Tedesco committed 2011-01-11 18:54:44 +00:00
1 parent bdf80c61cb
commit 5644ab84f7
2 files changed
+15 -2

No files matched your search

+4 -1
View File
@@ -51,7 +51,10 @@ def py_attrib_get(ty, f):
l.append('static PyObject *py_%s_%s_get(Py_%s *self, void *priv)'%(ty.rawname, f.name, ty.rawname))
l.append('{')
if t == TYPE_BOOL:
l.append(' return (self->obj.%s) ? Py_True : Py_False;'%f.name)
l.append(' PyObject *ret;')
l.append(' ret = (self->obj.%s) ? Py_True : Py_False;'%f.name)
l.append(' Py_INCREF(ret);')
l.append(' return ret;')
elif t == TYPE_INT:
l.append(' return genwrap__ll_get(self->obj.%s);'%f.name)
elif t == TYPE_UINT:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.