diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-07-14 20:37:29 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-07-14 20:37:29 +0200 |
| commit | e3745827634d8334f796a1506e575ab6f5efdaee (patch) | |
| tree | 3438c491dc8839831ecdadbf0af24b345bc8040b /python/generic.h | |
| parent | 18265daee119d7606a2102d8b20d9599f598d88c (diff) | |
| download | python-apt-e3745827634d8334f796a1506e575ab6f5efdaee.tar.gz | |
python/generic.h: Use Py_XINCREF instead of Py_INCREF in CppOwnedPyObject_NEW.
Reason: Owner may be NULL.
Diffstat (limited to 'python/generic.h')
| -rw-r--r-- | python/generic.h | 5 |
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; } |
