[issue35046] logging.StreamHandler performs two syscalls when one would do

Ulrich Petri report at bugs.python.org
Wed Feb 6 09:24:59 EST 2019


Ulrich Petri <python at ulo.pe> added the comment:

This change breaks (probably unsupported) uses of the logging module (esp. in combination with structlog) where non-string objects are passed through the .format() and .emit() calls.

Previously it was possible to set the terminator attribute to None (and then handling that case in a custom 'stream' implementation), which now breaks with a TypeError due to the concatenation.

In case anyone else runs into this (however unlikely that is). A workaround is to set the .terminator to something like this:

    class ConcatenableNothing:
        def __radd__(self, other):
            return other

----------
nosy: +ulope

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35046>
_______________________________________


More information about the Python-bugs-list mailing list