dry-python / dry-python/returns
Incorrect result type for `returns.curry.partial` with keyword arguments for positional parameters
- 主要語言
- Python
- 星號
- 4.4k
- 分支
- 154
- 平均合併
- 2 小時 27 分鐘
- 30 天內合併 PR
- 22
描述
# 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`
貢獻指南
研究方向
從 returns.curry.partial 進入點開始,使用 Python 3.13.4、returns 0.25.0 和 mypy 1.15.0,透過 foo 範例重現此問題。當一個透過關鍵字部分套用的位置參數產生一個剩餘參數為僅限關鍵字參數的型別,且型別檢查拒絕位置參數用法時,工作即完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- devtools
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100