-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Crash Report
When using python 3.14, mypy crashes right away. This is due the AugmentedHelpFormatter
class in mypy which does not accept all arguments of argparse.HelpFormatter
. In python 3.14,_get_formatter
of argparse will pass prefix_chars
which is not supported by AugmentedHelpFormatter
.
Proposal: change the constructor of AugmentedHelpFormatter like
class AugmentedHelpFormatter(argparse.RawDescriptionHelpFormatter):
def __init__(self, prog: str, **kwargs: Any) -> None:
super().__init__(prog=prog, max_help_position=28, **kwargs)
By the way, the same applies to the color
keyword, which is passed as well
Traceback
File "venv314/lib/python3.14/site-packages/mypy/__main__.py", line 15, in console_entry
main()
~~~~^^
File "venv314/lib/python3.14/site-packages/mypy/main.py", line 88, in main
sources, options = process_options(args, stdout=stdout, stderr=stderr, fscache=fscache)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv314/lib/python3.14/site-packages/mypy/main.py", line 1055, in process_options
parser.add_argument(
~~~~~~~~~~~~~~~~~~~^
"--enable-incomplete-feature",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<2 lines>...
help="Enable support of incomplete/experimental features for early preview",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/data/.pyenv/versions/3.14.0b1/lib/python3.14/argparse.py", line 1562, in add_argument
formatter = self._get_formatter()
File "/data/.pyenv/versions/3.14.0b1/lib/python3.14/argparse.py", line 2729, in _get_formatter
return self.formatter_class(
~~~~~~~~~~~~~~~~~~~~^
prog=self.prog,
^^^^^^^^^^^^^^^
prefix_chars=self.prefix_chars,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
color=self.color,
^^^^^^^^^^^^^^^^^
)
^
TypeError: AugmentedHelpFormatter.__init__() got an unexpected keyword argument 'prefix_chars'.)
To Reproduce
- setup a python 3.14 environment
- run
mypy --version
Your Environment
- Mypy version used: 1.15.0
- Mypy command-line flags: --version
- Mypy configuration options from
mypy.ini
(and other config files): n/a - Python version used: 3.1.4.0b1
- Operating system and version: Linux