bpo-30767: check formatException() input parameter for proper type, width and not None by tb3088 · Pull Request #3972 · python/cpython (original) (raw)

logger.log() can be invoked with a kwargs of exc_info="a Truthy Value" which can take the form of a long list of datatypes: integer, string, Object, etc. The function fails to check it's parameter datatype and blindly tries to reference elements as if only Tuples were possible. This immediately raises a TypeError and potentially an IndexError.

Furthermore if an earlier invocation of 'sys.exc_info()' was unable to find a stack frame it returns (None, None, None) which formatException() then unhelpfully renders into "NoneType None" as part of the stack trace.

https://bugs.python.org/issue30767