Author inada.naoki
Recipients Phil Kang, inada.naoki, lukasz.langa, xtreak
Date 2019-03-06.06:30:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1551853812.79.0.569895217478.issue35838@roundup.psfhosted.org>
In-reply-to
Content
It seems twice call of `optionxform` is not avoidable when read-and-write workflow.
I'm not against about fixing readdict.
But I don't think configparser supports non-idempotent optionxform.

>>> import configparser
>>> cfg = configparser.ConfigParser()
>>> cfg.optionxform = lambda s: "#"+s
>>> cfg.add_section("sec")
>>> cfg.set("sec", "foo", "1")
>>> cfg["sec2"] = cfg["sec"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/inada-n/work/python/cpython/Lib/configparser.py", line 974, in __setitem__
    self.read_dict({key: value})
  File "/Users/inada-n/work/python/cpython/Lib/configparser.py", line 747, in read_dict
    for key, value in keys.items():
  File "/Users/inada-n/work/python/cpython/Lib/_collections_abc.py", line 744, in __iter__
    yield (key, self._mapping[key])
  File "/Users/inada-n/work/python/cpython/Lib/configparser.py", line 1254, in __getitem__
    raise KeyError(key)
KeyError: '#foo'
History
Date User Action Args
2019-03-06 06:30:12inada.naokisetrecipients: + inada.naoki, lukasz.langa, xtreak, Phil Kang
2019-03-06 06:30:12inada.naokisetmessageid: <1551853812.79.0.569895217478.issue35838@roundup.psfhosted.org>
2019-03-06 06:30:12inada.naokilinkissue35838 messages
2019-03-06 06:30:12inada.naokicreate