summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 0de095f..aa73740 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -470,6 +470,20 @@ PyObject_IsTrue(v)
return res;
}
+/* equivalent of 'not v'
+ Return -1 if an error occurred */
+
+int
+PyObject_Not(v)
+ PyObject *v;
+{
+ int res;
+ res = PyObject_IsTrue(v);
+ if (res < 0)
+ return res;
+ return res == 0;
+}
+
/* Coerce two numeric types to the "larger" one.
Increment the reference count on each argument.
Return -1 and raise an exception if no coercion is possible