Message304265
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: |
|
Date |
User |
Action |
Args |
2017-10-12 16:17:07 | mp5023 | set | recipients:
+ mp5023, rhettinger, vinay.sajip, serhiy.storchaka, krivushinme |
2017-10-12 16:17:07 | mp5023 | set | messageid: <1507825027.28.0.213398074469.issue30767@psf.upfronthosting.co.za> |
2017-10-12 16:17:07 | mp5023 | link | issue30767 messages |
2017-10-12 16:17:07 | mp5023 | create | |
|