dry-python / dry-python/returns
Incorrect result type for `returns.curry.partial` with keyword arguments for positional parameters
- Linguagem predominante
- Python
- Estrelas
- 4.4k
- Forks
- 155
- Merge médio
- 2h 27min
- PRs com merge (30d)
- 22
Descrição
# Bug report
## What's wrong
When using `returns.curry.partial`, if you partially apply a positional parameter using a keyword argument, the resulting type is incorrect. Result type of callable allows passing the remaining arguments as positional, but this leads to a runtime error.
### Example
```python
def foo(x: int, y: int) -> None:
...
bar = returns.curry.partial(foo, x=1)
reveal_type(bar)
# => Mypy: "def (y: builtins.int)"
# => Expected: "def (*, y: builtins.int)"
bar(2)
# No errors from mypy, but got runtime error
# TypeError: foo() got multiple values for argument 'x'
```
## How is that should be
In this scenario, the remaining parameters should be strictly keyword-only. The resulting type should reflect this restriction, and passing a positional argument should be flagged as an error at type checking time.
## System information
- `python` version: `3.13.4`
- `returns` version: `0.25.0`
- `mypy` version: `1.15.0`
Guia de contribuição
Direção de pesquisa
Comece no ponto de entrada returns.curry.partial e reproduza o problema com o exemplo foo usando Python 3.13.4, returns 0.25.0 e mypy 1.15.0. O trabalho estará concluído quando um parâmetro posicional parcialmente aplicado por keyword produzir um tipo de parâmetro restante somente keyword e o uso posicional for rejeitado pela verificação de tipos.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- devtools
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 45/100