This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients Phil Kang, lukasz.langa, methane, 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:12methanesetrecipients: + methane, lukasz.langa, xtreak, Phil Kang
2019-03-06 06:30:12methanesetmessageid: <1551853812.79.0.569895217478.issue35838@roundup.psfhosted.org>
2019-03-06 06:30:12methanelinkissue35838 messages
2019-03-06 06:30:12methanecreate