I've got this MRE:
import logging
stream_handler = logging.StreamHandler()
file_handler = logging.FileHandler('output.txt')
logger = logging.getLogger()
for handler in (stream_handler, file_handler):
logger.addHandler(handler)
mypy 0.942 with Python 3.9.5 complains
error: Argument 1 to "addHandler" of "Logger" has incompatible type "object": expected "Handler"
reveal_type says that stream_handler is a logging.StreamHandler[typing.TextIO] whereas file_handler is a logging.FileHandler.
The error doesn't appear with mypy 0.910.
I've got this MRE:
mypy 0.942 with Python 3.9.5 complains
reveal_typesays thatstream_handleris alogging.StreamHandler[typing.TextIO]whereasfile_handleris alogging.FileHandler.The error doesn't appear with mypy 0.910.