[Python-checkins] python/dist/src/Include object.h, 2.121,
2.122 boolobject.h, 1.4, 1.5
bcannon at users.sourceforge.net
bcannon at users.sourceforge.net
Sun Oct 19 17:19:42 EDT 2003
Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1:/tmp/cvs-serv22186/Include
Modified Files:
object.h boolobject.h
Log Message:
Defined macros Py_RETURN_(TRUE|FALSE|NONE) as helper functions for returning
the specified value. All three Py_INCREF the singleton and then return it.
Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.121
retrieving revision 2.122
diff -C2 -d -r2.121 -r2.122
*** object.h 23 May 2003 12:47:36 -0000 2.121
--- object.h 19 Oct 2003 21:19:40 -0000 2.122
***************
*** 634,637 ****
--- 634,640 ----
#define Py_None (&_Py_NoneStruct)
+ /* Macro for returning Py_None from a function */
+ #define Py_RETURN_NONE Py_INCREF(Py_None); return Py_None;
+
/*
Py_NotImplemented is a singleton used to signal that an operation is
Index: boolobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/boolobject.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** boolobject.h 12 Aug 2002 07:21:56 -0000 1.4
--- boolobject.h 19 Oct 2003 21:19:40 -0000 1.5
***************
*** 24,27 ****
--- 24,31 ----
#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;
+
/* Function to return a bool from a C long */
PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
More information about the Python-checkins
mailing list