Skip to content

Commit

Permalink
Trap exception directly instead of tracking with boolean.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 6, 2023
1 parent 965af23 commit f55e478
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions setuptools/config/setupcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f55e478

Please sign in to comment.