bpo-31406: Fix crash due to lack of type checking in subclassing. (#3477)

1 file changed