[Python-checkins] cpython (merge 3.2 -> 3.3): Issue #17034: Use Py_CLEAR() in bytesobject.c.

serhiy.storchaka python-checkins at python.org
Sat Feb 2 17:48:25 CET 2013


http://hg.python.org/cpython/rev/7e34c176aa6f
changeset:   81935:7e34c176aa6f
branch:      3.3
parent:      81926:785b8b49c3bf
parent:      81934:8a747dec89c5
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Feb 02 18:45:54 2013 +0200
summary:
  Issue #17034: Use Py_CLEAR() in bytesobject.c.

files:
  Objects/bytesobject.c |  12 ++++--------
  1 files changed, 4 insertions(+), 8 deletions(-)


diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -2831,8 +2831,7 @@
     if (*pv == NULL)
         return;
     if (w == NULL) {
-        Py_DECREF(*pv);
-        *pv = NULL;
+        Py_CLEAR(*pv);
         return;
     }
     v = bytes_concat(*pv, w);
@@ -2896,12 +2895,9 @@
 PyBytes_Fini(void)
 {
     int i;
-    for (i = 0; i < UCHAR_MAX + 1; i++) {
-        Py_XDECREF(characters[i]);
-        characters[i] = NULL;
-    }
-    Py_XDECREF(nullstring);
-    nullstring = NULL;
+    for (i = 0; i < UCHAR_MAX + 1; i++)
+        Py_CLEAR(characters[i]);
+    Py_CLEAR(nullstring);
 }
 
 /*********************** Bytes Iterator ****************************/

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list