Bug Report
Python 3.14 introduced functools.Placeholder so that you can create functions with partial() that choose which position arguments are filled in and which are passed through. However, MyPy rejects the typing of these values.
To Reproduce
From the docs
from functools import partial, Placeholder as _
remove = partial(str.replace, _, _, '')
Expected Behavior
MyPy recognises remove as partial function that takes two strings (the placeholders), accepts the placeholders as being placeholders for string variables, and the checks pass.
Actual Behavior
example.py:2: error: Argument 1 to "replace" of "str" has incompatible type "_PlaceholderType"; expected "str" [arg-type]
example.py:2: error: Argument 2 to "replace" of "str" has incompatible type "_PlaceholderType"; expected "str" [arg-type]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 1.19.1
- Mypy command-line flags:
mypy example.py
- Mypy configuration options from
mypy.ini (and other config files): None
- Python version used: 3.14
Bug Report
Python 3.14 introduced
functools.Placeholderso that you can create functions withpartial()that choose which position arguments are filled in and which are passed through. However, MyPy rejects the typing of these values.To Reproduce
From the docs
Expected Behavior
MyPy recognises
removeas partial function that takes two strings (the placeholders), accepts the placeholders as being placeholders for string variables, and the checks pass.Actual Behavior
Your Environment
mypy example.pymypy.ini(and other config files): None