Skip to content

Commit 102b99e

Browse files
committed
Enable colored output for argparse in 3.14
1 parent 7f5a8dd commit 102b99e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mypy/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,10 @@ def process_options(
480480
stdout = stdout or sys.stdout
481481
stderr = stderr or sys.stderr
482482

483+
parser_kwargs: dict[str, Any] = {}
484+
if sys.version_info >= (3, 14):
485+
parser_kwargs["color"] = True
486+
483487
parser = CapturableArgumentParser(
484488
prog=program,
485489
usage=header,
@@ -490,6 +494,7 @@ def process_options(
490494
add_help=False,
491495
stdout=stdout,
492496
stderr=stderr,
497+
**parser_kwargs,
493498
)
494499

495500
strict_flag_names: list[str] = []

0 commit comments

Comments
 (0)