[issue35954] Incoherent type conversion in configparser
Rémi Lapeyre
report at bugs.python.org
Tue Feb 19 03:27:21 EST 2019
Rémi Lapeyre <remi.lapeyre at henki.fr> added the comment:
Other methods validate explicitly their arguments with _validate_value_types for example.
Here it raises KeyError which does not seem to be the appropriate exception. ConfigParser implementing the mapping protocol it seems weird to me to have
>>> a = 123
>>> config[a] = {}
>>> config[a]
KeyError: 123
I would have prefered a TypeError to be raised on __setitem__ but this is now documented behavior.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35954>
_______________________________________
More information about the Python-bugs-list
mailing list