Incorrect result type for `returns.curry.partial` with keyword arguments for positional parameters
まだ誰も着手していません。
評価
調査の方向性
returns.curry.partial エントリポイントから開始し、Python 3.13.4、returns 0.25.0、mypy 1.15.0 を使って foo の例で問題を再現してください。キーワードで部分適用された位置引数パラメーターが、残りのパラメーターをキーワード専用とする型を生成し、位置引数での使用が型チェックによって拒否されれば、作業は完了です。
索引モデルが issue の本文から書いたものです。
説明
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
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
pythonversion:3.13.4returnsversion:0.25.0mypyversion:1.15.0
- 主要言語
- Python
- スター
- 4.4k
- フォーク
- 154
- 平均マージ
- 3時間 5分
- マージ済み PR(30日)
- 22
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dry-python/returns のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
dry-python/returns#2394 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
dry-python/returns#2365 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
dry-python/returns#2355 · コメント 1 件 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
dry-python/returns#2295 · コメント 4 件 · リアクション 1 件 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
dry-python/returns#2253 · コメント 2 件 ·
dry-python/returns の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anthropics/skills#1811 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
speaches-ai/speaches#678 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
datalayer/mcp-compose#42 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
conda-forge/spacy-feedstock#177 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
UKGovernmentBEIS/inspect_evals#2523 ·