diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-08-06 10:59:57 +0100 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-08-06 11:04:31 +0100 |
| commit | 22a109999af164c644e0f83d243a12418fc46263 (patch) | |
| tree | 4a8283efb5b7e2ec2ed2682cc5a6697f5c69f94c /setuptools/config | |
| parent | dc4391e24ddf02876cc2e7921224fed571c84c12 (diff) | |
| download | python-setuptools-git-22a109999af164c644e0f83d243a12418fc46263.tar.gz | |
setup.cfg parsing: use contextlib.suppress instead of try/except+pass
Diffstat (limited to 'setuptools/config')
| -rw-r--r-- | setuptools/config/setupcfg.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/setuptools/config/setupcfg.py b/setuptools/config/setupcfg.py index 87f4d533..c2a974de 100644 --- a/setuptools/config/setupcfg.py +++ b/setuptools/config/setupcfg.py @@ -465,10 +465,9 @@ class ConfigHandler(Generic[Target]): :param dict section_options: """ for (name, (_, value)) in section_options.items(): - try: + with contextlib.suppress(KeyError): + # Keep silent for a new option may appear anytime. self[name] = value - except KeyError: - pass # Keep silent for a new option may appear anytime. def parse(self): """Parses configuration file items from one |
