[issue12036] ConfigParser: items() adds the vars dictionary to the result

Isaac Jurado report at bugs.python.org
Mon May 9 16:38:21 CEST 2011


New submission from Isaac Jurado <ijurado at econcept.es>:

>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

----------
components: Library (Lib)
files: test.ini
messages: 135591
nosy: Isaac.Jurado
priority: normal
severity: normal
status: open
title: ConfigParser: items() adds the vars dictionary to the result
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file21942/test.ini

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12036>
_______________________________________


More information about the Python-bugs-list mailing list