Author: Antonio Cuni <[email protected]>
Branch: 
Changeset: r59151:60670d2128f2
Date: 2012-11-30 15:41 +0000
http://bitbucket.org/pypy/pypy/changeset/60670d2128f2/

Log:    use a proper if/else instead of a conditional expression, which
        seems to be handled well by g++: this is necessary to (try to)
        compile boost-python against pypy

diff --git a/pypy/module/cpyext/include/object.h 
b/pypy/module/cpyext/include/object.h
--- a/pypy/module/cpyext/include/object.h
+++ b/pypy/module/cpyext/include/object.h
@@ -47,8 +47,13 @@
 #else
 /* Fast version */
 #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_DECREF(ob)                                   \
+    do {                                                \
+        if (((PyObject *)ob)->ob_refcnt > 1)            \
+            ((PyObject *)ob)->ob_refcnt--;              \
+        else                                            \
+            Py_DecRef((PyObject *)ob);                  \
+    } while (0)
 
 #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)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to