[issue18260] configparser: TypeError occurs when handling errors in files with binary names

Łukasz Langa report at bugs.python.org
Sun Jun 23 19:15:09 CEST 2013


Łukasz Langa added the comment:

1. Duplicate sections and options are consciously reported as errors now. This is a documented backwards-incompatible change [1]_. If you wish to revert to previous behaviour, you can set strict=False on parser creation.

2. It's really just a coincidence that specifying the filename as bytes worked in this case before on Python 3. That being said, it is indeed an unfortunate regression and was fixed in 56c1227f21f5 for 3.3 and 06e70937364b for 3.4. As a workaround for Python versions < 3.3.3 you can specify the source name as a Unicode string (e.g. `read_file(f, source=path_str)`.


.. [1] http://docs.python.org/3/library/configparser.html#customizing-parser-behaviour

----------
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18260>
_______________________________________


More information about the Python-bugs-list mailing list