diff --git a/src/darker/formatters/pyupgrade_formatter.py b/src/darker/formatters/pyupgrade_formatter.py index b885bda73..95d6b73b5 100644 --- a/src/darker/formatters/pyupgrade_formatter.py +++ b/src/darker/formatters/pyupgrade_formatter.py @@ -112,6 +112,8 @@ def _get_supported_target_versions() -> set[tuple[int, int]]: sys.stdout = buf = io.StringIO() try: main(["--help"]) + except SystemExit: # expected from argparse + pass finally: sys.stdout = stdout version_strs = (