Fixed issue #18260: configparser TypeError on source name specified as bytes

This commit is contained in:
Łukasz Langa 2013-06-23 19:10:25 +02:00
parent 36a7e4f74a
commit f9b4eb4d04
2 changed files with 65 additions and 13 deletions

View file

@ -191,7 +191,7 @@ class DuplicateSectionError(Error):
def __init__(self, section, source=None, lineno=None):
msg = [repr(section), " already exists"]
if source is not None:
message = ["While reading from ", source]
message = ["While reading from ", repr(source)]
if lineno is not None:
message.append(" [line {0:2d}]".format(lineno))
message.append(": section ")
@ -217,7 +217,7 @@ class DuplicateOptionError(Error):
msg = [repr(option), " in section ", repr(section),
" already exists"]
if source is not None:
message = ["While reading from ", source]
message = ["While reading from ", repr(source)]
if lineno is not None:
message.append(" [line {0:2d}]".format(lineno))
message.append(": option ")