[Python-checkins] python/dist/src/Include boolobject.h, 1.6, 1.7 object.h, 2.123, 2.124

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Sun Oct 19 18:58:13 EDT 2003


Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1:/tmp/cvs-serv5296/Include

Modified Files:
	boolobject.h object.h 
Log Message:
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 ...``.


Index: boolobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/boolobject.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** boolobject.h	19 Oct 2003 21:31:43 -0000	1.6
--- boolobject.h	19 Oct 2003 22:58:10 -0000	1.7
***************
*** 25,30 ****
  
  /* 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;}
  
  /* Function to return a bool from a C long */
--- 25,30 ----
  
  /* Macros for returning Py_True or Py_False, respectively */
! #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 */

Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.123
retrieving revision 2.124
diff -C2 -d -r2.123 -r2.124
*** object.h	19 Oct 2003 21:31:43 -0000	2.123
--- object.h	19 Oct 2003 22:58:11 -0000	2.124
***************
*** 635,639 ****
  
  /* Macro for returning Py_None from a function */
! #define Py_RETURN_NONE {Py_INCREF(Py_None); return Py_None;}
  
  /*
--- 635,639 ----
  
  /* Macro for returning Py_None from a function */
! #define Py_RETURN_NONE do {Py_INCREF(Py_None); return Py_None;} while (0)
  
  /*





More information about the Python-checkins mailing list