Message202538
Various exceptions raised by configparser module leaks implementation detail, by chaining KeyErrors, as seen below:
Python 3.4.0a4+ (default:0aa2aedc6a21+, Nov 5 2013, 17:10:42)
[GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
>>> import configparser
>>> parser = configparser.ConfigParser()
>>> parser.remove_option('Section1', 'an_int')
Traceback (most recent call last):
File "/tank/libs/cpython/Lib/configparser.py", line 935, in remove_option
sectdict = self._sections[section]
KeyError: 'Section1'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tank/libs/cpython/Lib/configparser.py", line 937, in remove_option
raise NoSectionError(section)
configparser.NoSectionError: No section: 'Section1'
>>>
There are multiple places where this happens: using basic and extended interpolation, using .options to retrieve non-existent options, using .get or .remove_options for non-existent options/sections. The attached patch tries to fixes all those issues by suppressing the initial exception. |
|
Date |
User |
Action |
Args |
2013-11-10 17:16:52 | Claudiu.Popa | set | recipients:
+ Claudiu.Popa, lukasz.langa |
2013-11-10 17:16:52 | Claudiu.Popa | set | messageid: <1384103812.47.0.904880324738.issue19546@psf.upfronthosting.co.za> |
2013-11-10 17:16:52 | Claudiu.Popa | link | issue19546 messages |
2013-11-10 17:16:52 | Claudiu.Popa | create | |
|