Issue32108
Created on 2017-11-21 17:46 by simonltwick, last changed 2019-02-17 01:34 by cheryl.sabella. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 4607 | closed | corona10, 2017-11-28 10:54 | |
| PR 7588 | merged | cheryl.sabella, 2018-06-10 16:33 | |
| Messages (5) | |||
|---|---|---|---|
| msg306675 - (view) | Author: Simon Lambourn (simonltwick) | Date: 2017-11-21 17:46 | |
If you assign a ConfigParser section back to the parent ConfigParser object (say after updating the section), the section is emptied.
(I realise now that you don't need to assign the section back to the parent as it's a proxy for the section in the parent already - but still it does not behave as you would expect):
code:
from configparser import ConfigParser
config = ConfigParser()
config['test'] = {'key': 'value'}
section = config['test']
section['key'] = 'different'
print("before: config['test'] is %s" % dict(config['test']))
config['test'] = section
print("after: config['test'] is %s" % dict(config['test']))
# the section is now printed as {}
|
|||
| msg306682 - (view) | Author: Łukasz Langa (lukasz.langa) * | Date: 2017-11-21 20:05 | |
Confirmed. |
|||
| msg307131 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2017-11-28 15:43 | |
PR 4607 doesn't look a correct solution to me. I don't know a precedence of calling deepcopy() for a value in __setitem__(). deepcopy() is too heavy, calling it can slow down normal cases. Using deepcopy likely means a bad design. |
|||
| msg315425 - (view) | Author: Łukasz Langa (lukasz.langa) * | Date: 2018-04-17 21:51 | |
I agree, the fix needs to be changed. What we probably want is to discover this kind of assignment and special-case *that*. |
|||
| msg319400 - (view) | Author: Łukasz Langa (lukasz.langa) * | Date: 2018-06-12 20:37 | |
New changeset 33cd058f21d0673253c88cea70388282918992bc by Łukasz Langa (Cheryl Sabella) in branch 'master': bpo-32108: Don't clear configparser values if key is assigned to itself (GH-7588) https://github.com/python/cpython/commit/33cd058f21d0673253c88cea70388282918992bc |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-02-17 01:34:39 | cheryl.sabella | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018-06-12 20:37:57 | lukasz.langa | set | messages: + msg319400 |
| 2018-06-10 16:33:41 | cheryl.sabella | set | pull_requests: + pull_request7210 |
| 2018-04-17 21:51:07 | lukasz.langa | set | messages:
+ msg315425 versions: + Python 3.6, Python 3.7, Python 3.8, - Python 3.5 |
| 2017-11-28 15:43:05 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg307131 |
| 2017-11-28 11:01:03 | corona10 | set | nosy:
+ corona10 |
| 2017-11-28 10:54:36 | corona10 | set | keywords:
+ patch stage: patch review pull_requests: + pull_request4523 |
| 2017-11-21 20:05:44 | lukasz.langa | set | messages: + msg306682 |
| 2017-11-21 18:43:15 | r.david.murray | set | nosy:
+ lukasz.langa |
| 2017-11-21 17:46:10 | simonltwick | create | |