diff options
author | Guido van Rossum <guido@python.org> | 1998-04-09 17:53:59 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-04-09 17:53:59 (GMT) |
commit | c3d3f9692d2ac91d064681621240121a9407501d (patch) | |
tree | f23fa0faa71d06d51d7b6346a4de84b4c5f4f9e7 /Objects/object.c | |
parent | 6b529ae0c0751810f2a96d7a2afdde639af4d030 (diff) | |
download | cpython-c3d3f9692d2ac91d064681621240121a9407501d.zip cpython-c3d3f9692d2ac91d064681621240121a9407501d.tar.gz cpython-c3d3f9692d2ac91d064681621240121a9407501d.tar.bz2 |
Add PyObject_Not().
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 14 |
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 |