New submission from Sean Robertson <sdrob...@cs.toronto.edu>:

Hello and thanks for reading.

I've also experienced this in Python 3.7, and I believe it to be around since 
3.2.

The allow_no_value option of ConfigParser allows None values when 
(de)serializing configuration files. Yet calling the "items(section)" method of 
a ConfigParser returns empty strings for values instead of None. See below for 
an MRE.

Thanks,
Sean

Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from configparser import ConfigParser
>>> a = ConfigParser(allow_no_value=True)
>>> a.add_section('foo')
>>> a.set('foo', 'bar')
>>> a.items('foo')
[('bar', '')]
>>> a.items('foo', raw=True)
[('bar', None)]
>>> a.get('foo', 'bar')
>>> list(a['foo'].items())
[('bar', None)]

----------
components: Library (Lib)
messages: 350331
nosy: Sean Robertson
priority: normal
severity: normal
status: open
title: ConfigParser.items(section) with allow_no_value returns empty strings
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37932>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to