diff options
author | Brian Curtin <brian@python.org> | 2011-08-11 01:28:54 (GMT) |
---|---|---|
committer | Brian Curtin <brian@python.org> | 2011-08-11 01:28:54 (GMT) |
commit | dfc80e3d97680ee26e509daba4a08502fefe22ee (patch) | |
tree | f28c4978ce126c4308a45aa594f0f2c86dfc1965 /Objects/setobject.c | |
parent | 7d2f9e13424fe74814e14cf92d7bbd779917a5c5 (diff) | |
download | cpython-dfc80e3d97680ee26e509daba4a08502fefe22ee.zip cpython-dfc80e3d97680ee26e509daba4a08502fefe22ee.tar.gz cpython-dfc80e3d97680ee26e509daba4a08502fefe22ee.tar.bz2 |
Replace Py_NotImplemented returns with the macro form Py_RETURN_NOTIMPLEMENTED.
The macro was introduced in #12724.
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r-- | Objects/setobject.c | 59 |
1 files changed, 21 insertions, 38 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index 2e62518..d1bad27 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -1212,10 +1212,8 @@ set_or(PySetObject *so, PyObject *other) { PySetObject *result; - if (!PyAnySet_Check(so) || !PyAnySet_Check(other)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } + if (!PyAnySet_Check(so) || !PyAnySet_Check(other)) + Py_RETURN_NOTIMPLEMENTED; result = (PySetObject *)set_copy(so); if (result == NULL) @@ -1232,10 +1230,9 @@ set_or(PySetObject *so, PyObject *other) static PyObject * set_ior(PySetObject *so, PyObject *other) { - if (!PyAnySet_Check(other)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } + if (!PyAnySet_Check(other)) + Py_RETURN_NOTIMPLEMENTED; + if (set_update_internal(so, other) == -1) return NULL; Py_INCREF(so); @@ -1385,10 +1382,8 @@ PyDoc_STRVAR(intersection_update_doc, static PyObject * set_and(PySetObject *so, PyObject *other) { - if (!PyAnySet_Check(so) || !PyAnySet_Check(other)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } + if (!PyAnySet_Check(so) || !PyAnySet_Check(other)) + Py_RETURN_NOTIMPLEMENTED; return set_intersection(so, other); } @@ -1397,10 +1392,8 @@ set_iand(PySetObject *so, PyObject *other) { PyObject *result; - if (!PyAnySet_Check(other)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } + if (!PyAnySet_Check(other)) + Py_RETURN_NOTIMPLEMENTED; result = set_intersection_update(so, other); if (result == NULL) return NULL; @@ -1627,20 +1620,16 @@ PyDoc_STRVAR(difference_doc, static PyObject * set_sub(PySetObject *so, PyObject *other) { - if (!PyAnySet_Check(so) || !PyAnySet_Check(other)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } + if (!PyAnySet_Check(so) || !PyAnySet_Check(other)) + Py_RETURN_NOTIMPLEMENTED; return set_difference(so, other); } static PyObject * set_isub(PySetObject *so, PyObject *other) { - if (!PyAnySet_Check(other)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } + if (!PyAnySet_Check(other)) + Py_RETURN_NOTIMPLEMENTED; if (set_difference_update_internal(so, other) == -1) return NULL; Py_INCREF(so); @@ -1738,10 +1727,8 @@ PyDoc_STRVAR(symmetric_difference_doc, static PyObject * set_xor(PySetObject *so, PyObject *other) { - if (!PyAnySet_Check(so) || !PyAnySet_Check(other)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } + if (!PyAnySet_Check(so) || !PyAnySet_Check(other)) + Py_RETURN_NOTIMPLEMENTED; return set_symmetric_difference(so, other); } @@ -1750,10 +1737,8 @@ set_ixor(PySetObject *so, PyObject *other) { PyObject *result; - if (!PyAnySet_Check(other)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } + if (!PyAnySet_Check(other)) + Py_RETURN_NOTIMPLEMENTED; result = set_symmetric_difference_update(so, other); if (result == NULL) return NULL; @@ -1815,10 +1800,9 @@ set_richcompare(PySetObject *v, PyObject *w, int op) { PyObject *r1, *r2; - if(!PyAnySet_Check(w)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } + if(!PyAnySet_Check(w)) + Py_RETURN_NOTIMPLEMENTED; + switch (op) { case Py_EQ: if (PySet_GET_SIZE(v) != PySet_GET_SIZE(w)) @@ -1848,8 +1832,7 @@ set_richcompare(PySetObject *v, PyObject *w, int op) Py_RETURN_FALSE; return set_issuperset(v, w); } - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; + Py_RETURN_NOTIMPLEMENTED; } static PyObject * |