◐ Shell
clean mode source ↗

Update logging LogRecord msg attribute by aminalaee · Pull Request #9914 · python/typeshed

But I'm not sure it makes sense to only do a partial revert of #1776. msg annotations should probably be the same across all of logging/__init__.pyi. For example, logging.Logger.debug currently uses object as the annotation for the msg parameter:

def debug(
self,
msg: object,

But logging.Logger.debug calls logging.Logger._log, which passes msg to logging._logRecordFactory, and logging._logRecordFactory is an alias for logging.LogRecord. So if you passed a non-str object to logging.Logger.debug, you'd end up passing a non-str object to the logging.LogRecord constructor. Meaning that the annotation for the msg parameter for logging.Logger.debug (and logging.Logger.{info,warning,warn,error,exception,critical,log,_log}) should be kept in sync with the annotation for the msg parameter of logging.LogRecord.__init__.