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 wolfmanx
Recipients lukasz.langa, python-dev, wolfmanx
Date 2012-12-31.17:42:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1356975769.4.0.862090452.issue16820@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks, works for me.

I only noted the discrepancy and did not give it much thought.
I will just implement a merge method on top of read_dict.
That gives me all options that could be desired :).

However, after implementing the entire compatibility layer, I found one more issue:

Using self.remove_section() changes the section order during an update.
I would prefer that the section be cleared instead of removed in order to preserve the section order. Since OrderedDict does indeed preserve the key order during update, I think that this does not violate the Mapping Protocol.

If this is not desired, just go ahead and close the issue.

See also attached example bug_configparser_update_order.py:

OrderedDict does not change the order of keys upon .update():

    >>> od = OrderedDict((('section1', {}), ('section2', {})))

    >>> list(od.keys())
    ['section1', 'section2']

    >>> od.update((('section1', {}), ('section3', {})))

    >>> list(od.keys())
    ['section1', 'section2', 'section3']

But ConfigParser changes the order of sections upon .update():

    >>> cfg = configparser.ConfigParser()
    >>> cfg.update((('section1', {}), ('section2', {})))

    >>> cfg.sections()
    ['section1', 'section2']

    >>> cfg.update((('section1', {}), ('section3', {})))

    >>> cfg.sections()
    ['section2', 'section1', 'section3']
History
Date User Action Args
2012-12-31 17:42:49wolfmanxsetrecipients: + wolfmanx, lukasz.langa, python-dev
2012-12-31 17:42:49wolfmanxsetmessageid: <1356975769.4.0.862090452.issue16820@psf.upfronthosting.co.za>
2012-12-31 17:42:49wolfmanxlinkissue16820 messages
2012-12-31 17:42:49wolfmanxcreate