classification
Title: ConfigParser: Document items() added the vars dictionary to the result
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: lukasz.langa Nosy List: Isaac.Jurado, lukasz.langa, python-dev
Priority: low Keywords:

Created on 2011-05-09 14:38 by Isaac.Jurado, last changed 2011-05-09 16:51 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
test.ini Isaac.Jurado, 2011-05-09 14:38 Sample dumb config file.
Messages (3)
msg135591 - (view) Author: Isaac Jurado (Isaac.Jurado) Date: 2011-05-09 14:38
From the following python code:

import os
from ConfigParser import ConfigParser
from pprint import pprint
c = ConfigParser()
c.read(['test.ini'])
pprint(c.items('test', raw=False, vars=os.environ))

I see the values contained in os.environ as well as in section "test" (in the attached configuration example).

The problem seems to come from the following line:

http://hg.python.org/cpython/file/5395f96588d4/Lib/ConfigParser.py#l605

Which is fixed in py3k but for the 2.x branch has not been modified sin 2002:

http://hg.python.org/cpython/annotate/8bb6003f7f54/Lib/ConfigParser.py#514
msg135610 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2011-05-09 16:40
This annoyance can't be fixed in 2.x anymore since this is a change of behaviour requiring a full release. While it is very unlikely someone depended on this "feature", changing it breaks compatibility.

Reclassified as `Documentation` to explicitly describe that change in 3.2.
msg135613 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-05-09 16:51
New changeset 62e2b74c3bfc by Łukasz Langa in branch '3.2':
Closes #12036: ConfigParser: Document items() added the vars dictionary to the result
http://hg.python.org/cpython/rev/62e2b74c3bfc

New changeset 2d984cc4afb0 by Łukasz Langa in branch 'default':
Merged solution for #12036 from 3.2
http://hg.python.org/cpython/rev/2d984cc4afb0
History
Date User Action Args
2011-05-09 16:51:08python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg135613

resolution: fixed
stage: needs patch -> resolved
2011-05-09 16:49:17lukasz.langasettitle: ConfigParser: items() adds the vars dictionary to the result -> ConfigParser: Document items() added the vars dictionary to the result
2011-05-09 16:40:06lukasz.langasetpriority: normal -> low
versions: + Python 3.2, Python 3.3, - Python 2.6, Python 2.7
messages: + msg135610

assignee: lukasz.langa
components: + Documentation, - Library (Lib)
stage: needs patch
2011-05-09 15:15:49r.david.murraysetnosy: + lukasz.langa
2011-05-09 14:38:15Isaac.Juradocreate