mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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:
1 parent
bdf80c61cb
commit
5644ab84f7
2 files changed
+15
-2
No files matched your search
@@ -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:
|
||||
|
||||