]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Simplify defaultdict.__or__ (#18931)
authorBrandt Bucher <brandtbucher@gmail.com>
Thu, 12 Mar 2020 04:06:46 +0000 (21:06 -0700)
committerGitHub <noreply@github.com>
Thu, 12 Mar 2020 04:06:46 +0000 (21:06 -0700)
Modules/_collectionsmodule.c

index d0a381deabf5d8c941fa382e2048db4eae2d9759..fd0e4edcddfdbe22fbd55315188cfa205332f512 100644 (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;
     }