Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cbfc855

Browse files
committed
The "O!" format code should implement an isinstance() test
rather than a type equality test.
1 parent 63db7b9 commit cbfc855

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Python/getargs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf)
875875
type = va_arg(*p_va, PyTypeObject*);
876876
p = va_arg(*p_va, PyObject **);
877877
format++;
878-
if (arg->ob_type == type)
878+
if (PyType_IsSubtype(arg->ob_type, type))
879879
*p = arg;
880880
else
881881
return converterr(type->tp_name, arg, msgbuf);

0 commit comments

Comments
 (0)