Simplify defaultdict.__or__ (#18931)

This commit is contained in:
Brandt Bucher 2020-03-11 21:06:46 -07:00 committed by GitHub
parent c00c86b904
commit 1dd3794b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2133,12 +2133,8 @@ defdict_repr(defdictobject *dd)
static PyObject*
defdict_or(PyObject* left, PyObject* right)
{
int left_is_self = PyObject_IsInstance(left, (PyObject*)&defdict_type);
if (left_is_self < 0) {
return NULL;
}
PyObject *self, *other;
if (left_is_self) {
if (PyObject_TypeCheck(left, &defdict_type)) {
self = left;
other = right;
}