Mercurial > cpython-lru_cache-weakref
diff Objects/typeobject.c @ 71810:d0b0fcbb40db
Replace Py_NotImplemented returns with the macro form Py_RETURN_NOTIMPLEMENTED.
The macro was introduced in #12724.
| author | Brian Curtin <brian@python.org> |
|---|---|
| date | Wed, 10 Aug 2011 20:28:54 -0500 |
| parents | 0a040aa9bb34 |
| children | 45b63a8a76c9 |
line wrap: on
line diff
--- a/Objects/typeobject.c Wed Aug 10 20:05:21 2011 -0500 +++ b/Objects/typeobject.c Wed Aug 10 20:28:54 2011 -0500 @@ -1212,10 +1212,8 @@ func = lookup_maybe(o, name, nameobj); if (func == NULL) { va_end(va); - if (!PyErr_Occurred()) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } + if (!PyErr_Occurred()) + Py_RETURN_NOTIMPLEMENTED; return NULL; } @@ -3449,8 +3447,7 @@ static PyObject * object_subclasshook(PyObject *cls, PyObject *args) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; + Py_RETURN_NOTIMPLEMENTED; } PyDoc_STRVAR(object_subclasshook_doc, @@ -4818,8 +4815,7 @@ return call_maybe( \ other, ROPSTR, &rcache_str, "(O)", self); \ } \ - Py_INCREF(Py_NotImplemented); \ - return Py_NotImplemented; \ + Py_RETURN_NOTIMPLEMENTED; \ } #define SLOT1BIN(FUNCNAME, SLOTNAME, OPSTR, ROPSTR) \ @@ -4996,8 +4992,7 @@ return call_method(self, "__pow__", &pow_str, "(OO)", other, modulus); } - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; + Py_RETURN_NOTIMPLEMENTED; } SLOT0(slot_nb_negative, "__neg__") @@ -5320,8 +5315,7 @@ func = lookup_method(self, name_op[op], &op_str[op]); if (func == NULL) { PyErr_Clear(); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; + Py_RETURN_NOTIMPLEMENTED; } args = PyTuple_Pack(1, other); if (args == NULL)
