Matthew Patton <patto...@yahoo.com> added the comment: I believe this diff addresses the failure of formatException() to check it's parameter's datatype. I still maintain this should be re-opened since it's guaranteed to raise an exception when someone sets 'exc_info=TruthyValue' in kwargs. albeit with a more focused PR.
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 00a022039d..5c61cd56a1 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -533,6 +533,8 @@ class Formatter(object): This default implementation just uses traceback.print_exception() """ + if not isinstance(ei, tuple) or ei[0] is None: + return "" sio = io.StringIO() tb = ei[2] # See issues #9427, #1553375. Commented out for now. @@ -584,9 +586,7 @@ class Formatter(object): if self.usesTime(): record.asctime = self.formatTime(record, self.datefmt) s = self.formatMessage(record) - if (isinstance(record.exc_info, tuple) and record.exc_info[0]): - # Intercept 'Boolean' - causes subscript error if passed to formatException, - # and empty Tuples which emit 'NoneType None' into message. + if record.exc_info: # Cache the traceback text to avoid converting it multiple times # (it's constant anyway) if not record.exc_text: ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue30767> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com