[Python-checkins] cpython: Switch to more idiomatic C code.

eric.smith python-checkins at python.org
Fri Feb 5 18:26:24 EST 2016


https://hg.python.org/cpython/rev/f6a89f6cadd0
changeset:   100166:f6a89f6cadd0
user:        Eric V. Smith <eric at trueblade.com>
date:        Fri Feb 05 18:26:20 2016 -0500
summary:
  Switch to more idiomatic C code.

files:
  Python/ceval.c |  7 ++++---
  1 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3399,10 +3399,10 @@
             /* If there's a conversion function, call it and replace
                value with that result. Otherwise, just use value,
                without conversion. */
-            if (conv_fn) {
+            if (conv_fn != NULL) {
                 result = conv_fn(value);
                 Py_DECREF(value);
-                if (!result) {
+                if (result == NULL) {
                     Py_XDECREF(fmt_spec);
                     goto error;
                 }
@@ -3422,8 +3422,9 @@
                 result = PyObject_Format(value, fmt_spec);
                 Py_DECREF(value);
                 Py_XDECREF(fmt_spec);
-                if (!result)
+                if (result == NULL) {
                     goto error;
+                }
             }
 
             PUSH(result);

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


More information about the Python-checkins mailing list