New submission from Claudiu.Popa: 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. ---------- components: Library (Lib) files: configparser.patch keywords: patch messages: 202538 nosy: Claudiu.Popa, lukasz.langa priority: normal severity: normal status: open title: configparser leaks implementation detail versions: Python 3.4 Added file: http://bugs.python.org/file32564/configparser.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19546> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com