Skip to content

Commit 2eb2c72

Browse files
committed
Fix an exception that can occur on message handling within logging support.
Add belt and braces around the message splitting that occurs within the fake logger - should a message ever get here that cannot be split up as is expected we do not want to end up causing a distracting failure here.
1 parent 32d642f commit 2eb2c72

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/support/loggersupp.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ def warning(self, line):
101101

102102
def write(self, message):
103103
"""Actual write handler"""
104-
channel, namespace, specifics = message.split(':', 2)
104+
105+
try:
106+
channel, namespace, specifics = message.split(':', 2)
107+
except ValueError:
108+
# no channel on sme Python versions
109+
channel = 'ERROR'
110+
namespace = ''
111+
specifics = message
105112

106113
# ignore everything except warnings sent by the python runtime
107114
if not (channel == 'WARNING' and namespace == 'py.warnings'):

0 commit comments

Comments
 (0)