From f55e478bf84aceb420c52dd96982d92dc7b38626 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 5 Mar 2023 20:37:19 -0500 Subject: [PATCH] Trap exception directly instead of tracking with boolean. --- setuptools/config/setupcfg.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/setuptools/config/setupcfg.py b/setuptools/config/setupcfg.py index b172b94694..835d731483 100644 --- a/setuptools/config/setupcfg.py +++ b/setuptools/config/setupcfg.py @@ -293,18 +293,9 @@ def __setitem__(self, option_name, value): # Already inhabited. Skipping. return - skip_option = False - parser = self.parsers.get(option_name) - if parser: - try: - parsed = parser(value) - - except Exception: - skip_option = True - if not self.ignore_option_errors: - raise - - if skip_option: + try: + parsed = self.parsers.get(option_name, lambda x: x)(value) + except (Exception,) * self.ignore_option_errors: return setter = getattr(target_obj, 'set_%s' % option_name, None)