The code is crystal clear: assert lexer in ('standard', ...) or issubclass(lexer, Lexer) But the type hint said that lexer must be an _instance_ of Lexer, not a subclass. This change fixes it to require a subclass of Lexer.