Mercurial > cpython-lru_cache-weakref
diff Include/boolobject.h @ 30721:f80d8377840f legacy-trunk
Modify the Py_RETURN_* macros to be of the form ``do {...} while (0)`` in order
to handle situations like ``if (foo) Py_RETURN_NONE else ...``.
| author | Brett Cannon <bcannon@gmail.com> |
|---|---|
| date | Sun, 19 Oct 2003 22:58:11 +0000 |
| parents | 2bc79b3a953d |
| children | 1e2187f50631 |
line wrap: on
line diff
--- a/Include/boolobject.h Sun Oct 19 21:31:43 2003 +0000 +++ b/Include/boolobject.h Sun Oct 19 22:58:11 2003 +0000 @@ -24,8 +24,8 @@ #define Py_True ((PyObject *) &_Py_TrueStruct) /* Macros for returning Py_True or Py_False, respectively */ -#define Py_RETURN_TRUE {Py_INCREF(Py_True); return Py_True;} -#define Py_RETURN_FALSE {Py_INCREF(Py_False); return Py_False;} +#define Py_RETURN_TRUE do {Py_INCREF(Py_True); return Py_True;} while (0) +#define Py_RETURN_FALSE do {Py_INCREF(Py_False); return Py_False;} while (0) /* Function to return a bool from a C long */ PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
