Skip to content

Commit

Permalink
StreamHandler.__repr__: ensure that stream.name is a string
Browse files Browse the repository at this point in the history
This fixes a TypeError in case the `name` is a integer.

Ref: pytest-dev/pytest#2555
  • Loading branch information
blueyed committed Jul 5, 2017
1 parent 0c31163 commit eea7d22
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/logging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ def emit(self, record):

def __repr__(self):
level = getLevelName(self.level)
name = getattr(self.stream, 'name', '')
name = str(getattr(self.stream, 'name', ''))
if name:
name += ' '
return '<%s %s(%s)>' % (self.__class__.__name__, name, level)
Expand Down

0 comments on commit eea7d22

Please sign in to comment.