Bug #1737864: allow empty message in logging format routines.

This commit is contained in:
Georg Brandl 2007-06-19 12:36:00 +00:00
parent 072aaf7150
commit 75ec1dbd9d
1 changed files with 2 additions and 2 deletions

View File

@ -398,7 +398,7 @@ class Formatter:
traceback.print_exception(ei[0], ei[1], ei[2], None, sio) traceback.print_exception(ei[0], ei[1], ei[2], None, sio)
s = sio.getvalue() s = sio.getvalue()
sio.close() sio.close()
if s[-1] == "\n": if s[-1:] == "\n":
s = s[:-1] s = s[:-1]
return s return s
@ -425,7 +425,7 @@ class Formatter:
if not record.exc_text: if not record.exc_text:
record.exc_text = self.formatException(record.exc_info) record.exc_text = self.formatException(record.exc_info)
if record.exc_text: if record.exc_text:
if s[-1] != "\n": if s[-1:] != "\n":
s = s + "\n" s = s + "\n"
s = s + record.exc_text s = s + record.exc_text
return s return s