mirror of
https://github.com/python/cpython.git
synced 2025-09-15 21:26:04 +00:00
Fixed issue #18260: configparser TypeError on source name specified as bytes
This commit is contained in:
parent
36a7e4f74a
commit
f9b4eb4d04
2 changed files with 65 additions and 13 deletions
|
@ -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 ")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue