Henrique Andrade added the comment: The stream in this case (where I hit the bug) is just the console, but I suspect the same issue will affect other streams too.
A key piece of information is that this is probably triggered by having a custom SIGPIPE handler, which my particular application has. When a SIGPIPE handler is in place, errors such as EAGAIN and EWOULDBLOCK might be generated and the logging module wasn't resilient to it. Here is the unified patch output: 11:00:38|sequoia|/opt/continuum/anaconda> diff -u /opt/continuum/anaconda/pkgs/python-2.7.8-0/lib/python2.7/logging/__init__.py /opt/continuum/anaconda/pkgs/python-2.7.8-1/lib/python2.7/logging/__init__.py --- /opt/continuum/anaconda/pkgs/python-2.7.8-0/lib/python2.7/logging/__init__.py 2014-07-02 19:08:57.000000000 -0400 +++ /opt/continuum/anaconda/pkgs/python-2.7.8-1/lib/python2.7/logging/__init__.py 2015-09-22 13:57:39.196032267 -0400 @@ -23,7 +23,7 @@ To use, simply 'import logging' and log away! """ -import sys, os, time, cStringIO, traceback, warnings, weakref, collections +import sys, os, time, cStringIO, traceback, warnings, weakref, collections, errno __all__ = ['BASIC_FORMAT', 'BufferingFormatter', 'CRITICAL', 'DEBUG', 'ERROR', 'FATAL', 'FileHandler', 'Filter', 'Formatter', 'Handler', 'INFO', @@ -877,7 +877,13 @@ #An extra encoding step seems to be needed. stream.write((ufs % msg).encode(stream.encoding)) else: - stream.write(fs % msg) + while True: + try: + stream.write(fs % msg) + break + except IOError as e: + if e.errno != errno.EAGAIN: + raise except UnicodeError: stream.write(fs % msg.encode("UTF-8")) self.flush() On Thu, Oct 22, 2015 at 10:01 AM, STINNER Victor <rep...@bugs.python.org> wrote: > > STINNER Victor added the comment: > > What is the type of the stream? Is is a pipe or a regular file? Or a > socket? > > Can you please format the patch as an unified patch please? > > ---------- > nosy: +haypo > > _______________________________________ > Python tracker <rep...@bugs.python.org> > <http://bugs.python.org/issue25459> > _______________________________________ > ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25459> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com