classification
Title: ConfigParser no longer deepcopy compatible in 2.7
Type: Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: open Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Winterflower, asvetlov, lukasz.langa, rbcollins
Priority: normal Keywords:

Created on 2012-09-27 00:18 by rbcollins, last changed 2016-12-21 18:33 by lukasz.langa.

Messages (3)
msg171364 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2012-09-27 00:18
In 2.6 deepcopy(ConfigParser) worked, in 2.7 it doesn't due to the _optcre variable which is a compiled regex pattern.
msg172111 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-10-05 18:54
ConfigParser is not intended to be deep copy-able, at least documentation says nothing about it.
msg283772 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2016-12-21 18:33
Solved in 3.2+ by making it compatible with the Mapping protocol. So while you can't do deepcopy(), you can `parser2.read_dict(parser1)`.
History
Date User Action Args
2016-12-21 18:33:47lukasz.langasetresolution: fixed
dependencies: - Regex objects became uncopyable in 2.5
messages: + msg283772
2016-12-13 20:52:23serhiy.storchakasetdependencies: + Regex objects became uncopyable in 2.5
2016-12-13 20:11:37Winterflowersetnosy: + Winterflower
2012-10-05 18:54:47asvetlovsetnosy: + asvetlov, lukasz.langa
messages: + msg172111
2012-09-27 00:18:52rbcollinscreate