The "O!" format code should implement an isinstance() test

rather than a type equality test.
This commit is contained in:
Guido van Rossum 2001-08-28 16:37:51 +00:00
parent 63db7b9ca1
commit cbfc855f57

View 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);