The "O!" format code should implement an isinstance() test
authorGuido van Rossum <guido@python.org>
Tue, 28 Aug 2001 16:37:51 +0000 (16:37 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 28 Aug 2001 16:37:51 +0000 (16:37 +0000)
rather than a type equality test.

Python/getargs.c

index 9f76ac0b2ff9e074c2d7a173d1357ea8d85b5e5a..a4dc57a8c326c25d5ca6be726edd3299bcd97e24 100644 (file)
@@ -875,7 +875,7 @@ convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf)
                        type = va_arg(*p_va, PyTypeObject*);
                        p = va_arg(*p_va, PyObject **);
                        format++;
-                       if (arg->ob_type == type)
+                       if (PyType_IsSubtype(arg->ob_type, type))
                                *p = arg;
                        else
                                return converterr(type->tp_name, arg, msgbuf);