summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/generic.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/python/generic.h b/python/generic.h
index 639578c5..7f3a3809 100644
--- a/python/generic.h
+++ b/python/generic.h
@@ -176,7 +176,7 @@ inline CppOwnedPyObject<T> *CppOwnedPyObject_NEW(PyObject *Owner,
CppOwnedPyObject<T> *New = (CppOwnedPyObject<T>*)Type->tp_alloc(Type, 0);
new (&New->Object) T;
New->Owner = Owner;
- Py_INCREF(Owner);
+ Py_XINCREF(Owner);
return New;
}
@@ -190,8 +190,7 @@ inline CppOwnedPyObject<T> *CppOwnedPyObject_NEW(PyObject *Owner,
CppOwnedPyObject<T> *New = (CppOwnedPyObject<T>*)Type->tp_alloc(Type, 0);
new (&New->Object) T(Arg);
New->Owner = Owner;
- if (Owner != 0)
- Py_INCREF(Owner);
+ Py_XINCREF(Owner);
return New;
}