[Python-checkins] r71271 - in python/trunk: Include/object.h Misc/NEWS Modules/readline.c
matthias.klose
python-checkins at python.org
Sun Apr 5 23:19:14 CEST 2009
Author: matthias.klose
Date: Sun Apr 5 23:19:13 2009
New Revision: 71271
Log:
Issue #1113244: Py_XINCREF, Py_DECREF, Py_XDECREF: Add `do { ... } while (0)'
to avoid compiler warnings.
Modified:
python/trunk/Include/object.h
python/trunk/Misc/NEWS
python/trunk/Modules/readline.c
Modified: python/trunk/Include/object.h
==============================================================================
--- python/trunk/Include/object.h (original)
+++ python/trunk/Include/object.h Sun Apr 5 23:19:13 2009
@@ -801,8 +801,8 @@
} while (0)
/* Macros to use in case the object pointer may be NULL: */
-#define Py_XINCREF(op) if ((op) == NULL) ; else Py_INCREF(op)
-#define Py_XDECREF(op) if ((op) == NULL) ; else Py_DECREF(op)
+#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)
/*
These are provided as conveniences to Python runtime embedders, so that
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sun Apr 5 23:19:13 2009
@@ -207,7 +207,8 @@
- Issue #3845: In PyRun_SimpleFileExFlags avoid invalid memory access with
short file names.
-- Py_DECREF: Add `do { ... } while (0)' to avoid compiler warnings.
+- Issue #1113244: Py_XINCREF, Py_DECREF, Py_XDECREF: Add `do { ... } while (0)'
+ to avoid compiler warnings.
Library
-------
Modified: python/trunk/Modules/readline.c
==============================================================================
--- python/trunk/Modules/readline.c (original)
+++ python/trunk/Modules/readline.c Sun Apr 5 23:19:13 2009
@@ -694,13 +694,13 @@
r = PyObject_CallFunction(completion_display_matches_hook,
"sOi", matches[0], m, max_length);
- Py_DECREF(m), m=NULL;
+ Py_DECREF(m); m=NULL;
if (r == NULL ||
(r != Py_None && PyInt_AsLong(r) == -1 && PyErr_Occurred())) {
goto error;
}
- Py_XDECREF(r), r=NULL;
+ Py_XDECREF(r); r=NULL;
if (0) {
error:
More information about the Python-checkins
mailing list