[pypy-issue] [issue1121] [cpyext] speed up some macros

Stefan Behnel tracker at bugs.pypy.org
Sat Jun 30 00:36:57 CEST 2012


Stefan Behnel <stefan_ml at behnel.de> added the comment:

I think the preprocessor guard ended up the wrong way around. It should likely
read "#ifdef" instead of "#ifndef".

#ifndef PYPY_DEBUG_REFCOUNT
#define Py_INCREF(ob)   (Py_IncRef((PyObject *)ob))
#define Py_DECREF(ob)   (Py_DecRef((PyObject *)ob))
#define Py_XINCREF(ob)  (Py_IncRef((PyObject *)ob))
#define Py_XDECREF(ob)  (Py_DecRef((PyObject *)ob))
#else
#define Py_INCREF(ob)   (((PyObject *)ob)->ob_refcnt++)
#define Py_DECREF(ob)  ((((PyObject *)ob)->ob_refcnt > 1) ? \
                        ((PyObject *)ob)->ob_refcnt-- : (Py_DecRef((PyObject *)ob)))

#define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0)
#define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0)
#endif

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1121>
________________________________________


More information about the pypy-issue mailing list