Skip to content

[ty] Consider keyword arguments when unpacking a variadic argument#22796

Merged
dhruvmanila merged 1 commit intomainfrom
dhruv/unpack-arg
Jan 26, 2026
Merged

[ty] Consider keyword arguments when unpacking a variadic argument#22796
dhruvmanila merged 1 commit intomainfrom
dhruv/unpack-arg

Conversation

@dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Jan 22, 2026

Summary

fixes: astral-sh/ty#1584

This PR fixes a bug where ty would unpack a variadic argument consuming all the remaining unmatched parameters. The way this fix is implemented is by collecting the parameters for which an argument is provided via keyword e.g., func(foo=1). For example,

def foo(x: str, y: int): ...

def _(args: list[str]):
    foo(*args, y=1)

In the above example, main would currently raise parameter-already-assigned because we don't know how many elements would args unpack into so we consider assigning the type to all the remaining parameters. But, in the above case y has been provided as keyword argument explicitly.

Now, there are other cases like foo(*args, 1) or foo(*args, *(1,)) which is not considered in this PR i.e., this PR only handles explicit keyword argument and we would still emit diagnostic for positional, variadic, and keyword-variadic. Pyright behaves in the same way i.e., it only handles keyword argument while other type checkers (mypy, pyrefly) does not handle any cases. Refer to the new mdtest cases for all the cases.

Test Plan

Add new mdtests.

@dhruvmanila dhruvmanila added bug Something isn't working ty Multi-file analysis & type inference labels Jan 22, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 22, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 22, 2026

mypy_primer results

Changes were detected when running on open source projects
spack (https://github.com/spack/spack)
- lib/spack/spack/vendor/jsonschema/validators.py:682:61: error[parameter-already-assigned] Multiple values provided for parameter 2 (`base_uri`) of bound method `__init__`
- lib/spack/spack/vendor/jsonschema/validators.py:682:61: error[parameter-already-assigned] Multiple values provided for parameter 3 (`referrer`) of bound method `__init__`
- Found 4336 diagnostics
+ Found 4334 diagnostics

pip (https://github.com/pypa/pip)
+ src/pip/_vendor/cachecontrol/heuristics.py:73:65: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- src/pip/_vendor/pkg_resources/__init__.py:3415:5: error[no-matching-overload] No overload of function `warn` matches arguments

beartype (https://github.com/beartype/beartype)
+ beartype/_util/ast/utilastmake.py:289:82: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 496 diagnostics
+ Found 497 diagnostics

scrapy (https://github.com/scrapy/scrapy)
- scrapy/core/downloader/contextfactory.py:90:13: error[parameter-already-assigned] Multiple values provided for parameter 3 (`tls_verbose_logging`) of bound method `__init__`
- scrapy/core/downloader/contextfactory.py:90:13: error[parameter-already-assigned] Multiple values provided for parameter 4 (`tls_ciphers`) of bound method `__init__`
- Found 1778 diagnostics
+ Found 1776 diagnostics

sockeye (https://github.com/awslabs/sockeye)
- sockeye/inference.py:1241:53: error[parameter-already-assigned] Multiple values provided for parameter `unshift_target_factors` of function `_assemble_translation`
- Found 415 diagnostics
+ Found 414 diagnostics

vision (https://github.com/pytorch/vision)
- references/segmentation/train.py:20:54: error[parameter-already-assigned] Multiple values provided for parameter `mode` of bound method `__init__`
- test/test_backbone_utils.py:107:58: error[parameter-already-assigned] Multiple values provided for parameter `tracer_kwargs` of function `create_feature_extractor`
- test/test_backbone_utils.py:107:87: error[parameter-already-assigned] Multiple values provided for parameter `suppress_diff_warning` of function `create_feature_extractor`
- test/test_functional_tensor.py:388:48: error[parameter-already-assigned] Multiple values provided for parameter `device` of function `_create_data`
- test/test_functional_tensor.py:420:52: error[parameter-already-assigned] Multiple values provided for parameter `num_samples` of function `_create_data_batch`
- test/test_functional_tensor.py:420:67: error[parameter-already-assigned] Multiple values provided for parameter `device` of function `_create_data_batch`
+ torchvision/models/quantization/googlenet.py:42:79: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ torchvision/models/quantization/googlenet.py:53:79: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- torchvision/models/quantization/googlenet.py:78:20: error[parameter-already-assigned] Multiple values provided for parameter `blocks` of bound method `__init__`
+ torchvision/models/quantization/inception.py:44:79: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ torchvision/models/quantization/inception.py:55:79: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ torchvision/models/quantization/inception.py:66:79: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ torchvision/models/quantization/inception.py:77:79: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ torchvision/models/quantization/inception.py:88:79: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ torchvision/models/quantization/inception.py:122:79: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- torchvision/models/quantization/inception.py:129:13: error[parameter-already-assigned] Multiple values provided for parameter `inception_blocks` of bound method `__init__`
+ torchvision/models/quantization/mobilenetv3.py:86:83: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ torchvision/models/quantization/shufflenetv2.py:55:91: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- torchvision/transforms/transforms.py:1537:30: error[invalid-argument-type] Argument to function `affine` is incorrect: Expected `InterpolationMode`, found `int | float | tuple[int | float, int | float] | @Todo`
- torchvision/transforms/transforms.py:1537:30: error[invalid-argument-type] Argument to function `affine` is incorrect: Expected `list[int | float] | None`, found `int | float | tuple[int | float, int | float] | @Todo`
- torchvision/transforms/transforms.py:1537:30: error[invalid-argument-type] Argument to function `affine` is incorrect: Expected `list[int] | None`, found `int | float | tuple[int | float, int | float] | @Todo`
- torchvision/transforms/transforms.py:1537:36: error[parameter-already-assigned] Multiple values provided for parameter `interpolation` of function `affine`
- torchvision/transforms/transforms.py:1537:70: error[parameter-already-assigned] Multiple values provided for parameter `fill` of function `affine`
- torchvision/transforms/transforms.py:1537:81: error[parameter-already-assigned] Multiple values provided for parameter `center` of function `affine`
- Found 1403 diagnostics
+ Found 1399 diagnostics

cki-lib (https://gitlab.com/cki-project/cki-lib)
- tests/test_cronjob.py:65:25: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tzinfo | None`, found `Unknown | int`
- tests/test_cronjob.py:66:25: error[parameter-already-assigned] Multiple values provided for parameter `tzinfo` of function `__new__`
- Found 243 diagnostics
+ Found 241 diagnostics

discord.py (https://github.com/Rapptz/discord.py)
+ discord/ext/commands/bot.py:308:107: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ discord/ext/commands/bot.py:332:105: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- discord/ext/commands/core.py:1552:22: error[no-matching-overload] No overload of function `command` matches arguments
- discord/ext/commands/core.py:1609:22: error[no-matching-overload] No overload of function `group` matches arguments
+ discord/ext/commands/hybrid.py:854:107: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ discord/ext/commands/hybrid.py:878:105: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- discord/gateway.py:142:48: error[parameter-already-assigned] Multiple values provided for parameter `name` of bound method `__init__`
- Found 539 diagnostics
+ Found 540 diagnostics

apprise (https://github.com/caronc/apprise)
- apprise/plugins/telegram.py:433:69: error[parameter-already-assigned] Multiple values provided for parameter `fmt` of function `validate_regex`
- Found 2648 diagnostics
+ Found 2647 diagnostics

setuptools (https://github.com/pypa/setuptools)
- pkg_resources/__init__.py:3443:5: error[no-matching-overload] No overload of function `warn` matches arguments
- Found 1133 diagnostics
+ Found 1132 diagnostics

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/commands/__init__.py:669:41: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 2031 diagnostics
+ Found 2032 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
- src/integrations/prefect-dbt/prefect_dbt/core/settings.py:94:28: error[invalid-assignment] Object of type `T@resolve_block_document_references | dict[str, Any]` is not assignable to `dict[str, Any]`
+ src/integrations/prefect-dbt/prefect_dbt/core/settings.py:94:28: error[invalid-assignment] Object of type `dict[str, Any] | int | T@resolve_block_document_references | ... omitted 4 union elements` is not assignable to `dict[str, Any]`
- src/integrations/prefect-dbt/prefect_dbt/core/settings.py:99:28: error[invalid-assignment] Object of type `T@resolve_variables | dict[str, Any]` is not assignable to `dict[str, Any]`
+ src/integrations/prefect-dbt/prefect_dbt/core/settings.py:99:28: error[invalid-assignment] Object of type `int | T@resolve_variables | float | ... omitted 4 union elements` is not assignable to `dict[str, Any]`
- src/prefect/cli/deploy/_core.py:86:21: error[invalid-assignment] Object of type `T@resolve_block_document_references | dict[str, Any]` is not assignable to `dict[str, Any]`
+ src/prefect/cli/deploy/_core.py:86:21: error[invalid-assignment] Object of type `dict[str, Any] | int | T@resolve_block_document_references | ... omitted 4 union elements` is not assignable to `dict[str, Any]`
- src/prefect/cli/deploy/_core.py:87:21: error[invalid-assignment] Object of type `T@resolve_variables` is not assignable to `dict[str, Any]`
+ src/prefect/cli/deploy/_core.py:87:21: error[invalid-assignment] Object of type `int | T@resolve_variables | float | ... omitted 4 union elements` is not assignable to `dict[str, Any]`
- src/prefect/deployments/runner.py:795:70: warning[possibly-missing-attribute] Attribute `__name__` may be missing on object of type `Unknown | ((...) -> Any)`
+ src/prefect/deployments/runner.py:795:70: warning[possibly-missing-attribute] Attribute `__name__` may be missing on object of type `Unknown | (((...) -> Any) & ((*args: object, **kwargs: object) -> object))`
- src/prefect/deployments/steps/core.py:137:38: error[invalid-argument-type] Argument is incorrect: Expected `T@resolve_variables`, found `T@resolve_block_document_references | dict[str, Any]`
+ src/prefect/deployments/steps/core.py:137:38: error[invalid-argument-type] Argument is incorrect: Expected `T@resolve_variables`, found `dict[str, Any] | int | T@resolve_block_document_references | ... omitted 4 union elements`
- src/prefect/flow_engine.py:812:32: error[invalid-await] `Unknown | R@FlowRunEngine | Coroutine[Any, Any, R@FlowRunEngine]` is not awaitable
- src/prefect/flow_engine.py:1401:24: error[invalid-await] `Unknown | R@AsyncFlowRunEngine | Coroutine[Any, Any, R@AsyncFlowRunEngine]` is not awaitable
- src/prefect/flow_engine.py:1482:43: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Unknown | R@run_generator_flow_sync`
- src/prefect/flow_engine.py:1490:21: warning[possibly-missing-attribute] Attribute `throw` may be missing on object of type `Unknown | R@run_generator_flow_sync`
- src/prefect/flow_engine.py:1524:44: warning[possibly-missing-attribute] Attribute `__anext__` may be missing on object of type `Unknown | R@run_generator_flow_async`
- src/prefect/flow_engine.py:1531:25: warning[possibly-missing-attribute] Attribute `throw` may be missing on object of type `Unknown | R@run_generator_flow_async`
- src/prefect/flows.py:286:34: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
+ src/prefect/flows.py:286:34: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
- src/prefect/flows.py:404:68: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
+ src/prefect/flows.py:404:68: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
+ src/prefect/flows.py:1750:53: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- src/prefect/utilities/templating.py:320:13: error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `T@resolve_block_document_references | dict[str, Any]` on object of type `dict[str, Any]`
+ src/prefect/utilities/templating.py:320:13: error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `dict[str, Any] | int | T@resolve_block_document_references | ... omitted 4 union elements` on object of type `dict[str, Any]`
- src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_block_document_references | dict[str, Any]`, found `list[Unknown | T@resolve_block_document_references | dict[str, Any]]`
+ src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_block_document_references | dict[str, Any]`, found `list[Unknown | dict[str, Any] | int | ... omitted 5 union elements]`
- src/prefect/utilities/templating.py:437:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[object, Unknown | T@resolve_variables]`
+ src/prefect/utilities/templating.py:437:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[object, Unknown | int | T@resolve_variables | ... omitted 5 union elements]`
- src/prefect/utilities/templating.py:442:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `list[Unknown | T@resolve_variables]`
+ src/prefect/utilities/templating.py:442:16: error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `list[Unknown | int | T@resolve_variables | ... omitted 5 union elements]`
- src/prefect/workers/base.py:232:13: error[invalid-argument-type] Argument is incorrect: Expected `T@resolve_variables`, found `T@resolve_block_document_references | dict[str, Any]`
+ src/prefect/workers/base.py:232:13: error[invalid-argument-type] Argument is incorrect: Expected `T@resolve_variables`, found `dict[str, Any] | int | T@resolve_block_document_references | ... omitted 4 union elements`
- src/prefect/workers/base.py:234:20: error[invalid-argument-type] Argument expression after ** must be a mapping type: Found `T@resolve_variables`
+ src/prefect/workers/base.py:234:20: error[invalid-argument-type] Argument expression after ** must be a mapping type: Found `int | T@resolve_variables | float | ... omitted 4 union elements`
- Found 5387 diagnostics
+ Found 5382 diagnostics

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/build/wheel.py:99:20: error[no-matching-overload] No overload of bound method `__init__` matches arguments
- Found 47 diagnostics
+ Found 46 diagnostics

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- tests/debugging/probe/test_remoteconfig.py:48:67: error[parameter-already-assigned] Multiple values provided for parameter `status_logger` of bound method `__init__`
- Found 8240 diagnostics
+ Found 8239 diagnostics

jax (https://github.com/google/jax)
- jax/_src/random.py:1411:40: error[parameter-already-assigned] Multiple values provided for parameter `log_space` of function `_gamma_one`
- jax/experimental/array_serialization/serialization_test.py:68:43: error[parameter-already-assigned] Multiple values provided for parameter `shardings` of function `load`
- jax/experimental/sparse/bcoo.py:1044:78: error[parameter-already-assigned] Multiple values provided for parameter `dimension_numbers` of function `dot_general`
- Found 2886 diagnostics
+ Found 2883 diagnostics

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/inspection/_plot/partial_dependence.py:1390:23: error[no-matching-overload] No overload of function `linspace` matches arguments
- sklearn/inspection/_plot/tests/test_plot_partial_dependence.py:38:12: error[no-matching-overload] No overload of function `linspace` matches arguments
- sklearn/inspection/_plot/tests/test_plot_partial_dependence.py:1080:21: error[no-matching-overload] No overload of function `linspace` matches arguments
- sklearn/linear_model/tests/test_ridge.py:2106:31: error[parameter-already-assigned] Multiple values provided for parameter `atol` of function `assert_allclose`
- sklearn/linear_model/tests/test_ridge.py:2106:42: error[parameter-already-assigned] Multiple values provided for parameter `rtol` of function `assert_allclose`
- sklearn/metrics/_scorer.py:97:27: error[parameter-already-assigned] Multiple values provided for parameter `response_method` of function `_get_response_values`
- Found 2472 diagnostics
+ Found 2466 diagnostics

pandas (https://github.com/pandas-dev/pandas)
- pandas/tests/indexes/interval/test_indexing.py:107:46: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["left", "right", "both", "neither"]`, found `Unknown | int | float`
- pandas/tests/indexes/interval/test_indexing.py:107:54: error[parameter-already-assigned] Multiple values provided for parameter `closed` of bound method `__init__`
- pandas/tests/indexes/interval/test_indexing.py:110:42: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["left", "right", "both", "neither"]`, found `Unknown | int | float`
- pandas/tests/indexes/interval/test_indexing.py:110:50: error[parameter-already-assigned] Multiple values provided for parameter `closed` of bound method `__init__`
- pandas/tests/indexes/ranges/test_constructors.py:29:36: error[parameter-already-assigned] Multiple values provided for parameter `name` of function `__new__`
- pandas/tests/tseries/offsets/test_fiscal.py:24:33: error[parameter-already-assigned] Multiple values provided for parameter `variation` of bound method `__init__`
- pandas/tests/tseries/offsets/test_fiscal.py:28:33: error[parameter-already-assigned] Multiple values provided for parameter `variation` of bound method `__init__`
- pandas/tests/tseries/offsets/test_fiscal.py:32:26: error[parameter-already-assigned] Multiple values provided for parameter `variation` of bound method `__init__`
- pandas/tests/tseries/offsets/test_fiscal.py:36:26: error[parameter-already-assigned] Multiple values provided for parameter `variation` of bound method `__init__`
- Found 3749 diagnostics
+ Found 3740 diagnostics

sympy (https://github.com/sympy/sympy)
- sympy/physics/quantum/qexpr.py:235:51: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:227:56: error[parameter-already-assigned] Multiple values provided for parameter `binding` of bound method `__init__`
- sympy/printing/pretty/pretty.py:358:38: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:690:41: error[parameter-already-assigned] Multiple values provided for parameter `binding` of bound method `__init__`
- sympy/printing/pretty/pretty.py:817:21: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:845:38: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:976:13: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:1380:38: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:1659:17: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:1666:38: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:1777:81: error[parameter-already-assigned] Multiple values provided for parameter `binding` of bound method `__init__`
- sympy/printing/pretty/pretty.py:1871:38: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:1964:55: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:2345:71: error[parameter-already-assigned] Multiple values provided for parameter `binding` of bound method `__init__`
- sympy/printing/pretty/pretty.py:2643:38: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/pretty.py:2685:51: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/stringpict.py:417:51: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/stringpict.py:433:51: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/stringpict.py:479:40: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/stringpict.py:515:51: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/stringpict.py:530:60: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/printing/pretty/stringpict.py:537:52: error[parameter-already-assigned] Multiple values provided for parameter 4 (`binding`) of bound method `__init__`
- sympy/sets/tests/test_sets.py:1679:41: error[parameter-already-assigned] Multiple values provided for parameter `evaluate` of function `__new__`
- sympy/simplify/fu.py:700:39: error[parameter-already-assigned] Multiple values provided for parameter `two` of function `trig_split`
- sympy/solvers/tests/test_simplex.py:239:32: error[parameter-already-assigned] Multiple values provided for parameter `bounds` of function `linprog`
- sympy/solvers/tests/test_simplex.py:240:32: error[parameter-already-assigned] Multiple values provided for parameter `bounds` of function `linprog`
- sympy/stats/symbolic_multivariate_probability.py:179:55: error[parameter-already-assigned] Multiple values provided for parameter `condition` of function `__new__`
- sympy/stats/symbolic_probability.py:411:55: error[parameter-already-assigned] Multiple values provided for parameter `condition` of function `__new__`
- sympy/stats/symbolic_probability.py:534:76: error[parameter-already-assigned] Multiple values provided for parameter `condition` of function `__new__`
- Found 15653 diagnostics
+ Found 15624 diagnostics

scipy (https://github.com/scipy/scipy)
- scipy/interpolate/_bsplines.py:621:42: error[parameter-already-assigned] Multiple values provided for parameter `extrapolate` of bound method `construct_fast`
- scipy/interpolate/_bsplines.py:622:36: error[parameter-already-assigned] Multiple values provided for parameter `axis` of bound method `construct_fast`
- scipy/interpolate/_bsplines.py:664:42: error[parameter-already-assigned] Multiple values provided for parameter `extrapolate` of bound method `construct_fast`
- scipy/interpolate/_bsplines.py:665:36: error[parameter-already-assigned] Multiple values provided for parameter `axis` of bound method `construct_fast`
- scipy/interpolate/tests/test_rbfinterp.py:524:49: error[parameter-already-assigned] Multiple values provided for parameter `neighbors` of bound method `__init__`
- scipy/interpolate/tests/test_rbfinterp.py:566:49: error[parameter-already-assigned] Multiple values provided for parameter `neighbors` of bound method `__init__`
- scipy/optimize/_shgo_lib/_complex.py:503:61: error[parameter-already-assigned] Multiple values provided for parameter `bounds` of bound method `refine_local_space`
- scipy/optimize/_shgo_lib/_complex.py:520:57: error[parameter-already-assigned] Multiple values provided for parameter `bounds` of bound method `refine_local_space`
- scipy/signal/_filter_design.py:1366:35: error[parameter-already-assigned] Multiple values provided for parameter `pairing` of function `zpk2sos`
- scipy/signal/tests/test_filter_design.py:4341:31: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4341:31: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4341:31: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4341:31: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4341:31: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4342:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4342:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4342:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4342:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4342:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4345:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4345:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4345:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4345:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4345:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4346:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4346:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4346:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4346:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4346:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4349:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4349:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4349:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4349:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4349:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4350:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4350:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4350:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4350:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4350:30: error[parameter-already-assigned] Multiple values provided for parameter `output`
- scipy/signal/tests/test_filter_design.py:4561:32: error[parameter-already-assigned] Multiple values provided for parameter `fs` of function `iircomb`
- scipy/signal/tests/test_filter_design.py:4566:32: error[parameter-already-assigned] Multiple values provided for parameter `fs` of function `iircomb`
- scipy/signal/tests/test_filter_design.py:5043:34: error[parameter-already-assigned] Multiple values provided for parameter `fs` of function `gammatone`
- scipy/signal/tests/test_filter_design.py:5048:34: error[parameter-already-assigned] Multiple values provided for parameter `fs` of function `gammatone`
- scipy/signal/tests/test_filter_design.py:5054:34: error[parameter-already-assigned] Multiple values provided for parameter `numtaps` of function `gammatone`
- scipy/signal/tests/test_filter_design.py:5054:48: error[parameter-already-assigned] Multiple values provided for parameter `fs` of function `gammatone`
- scipy/sparse/linalg/_eigen/tests/test_svds.py:157:33: error[parameter-already-assigned] Multiple values provided for parameter `which` of function `_check_svds`
- scipy/sparse/linalg/_eigen/tests/test_svds.py:157:46: error[parameter-already-assigned] Multiple values provided for parameter `atol` of function `_check_svds`
- scipy/sparse/linalg/_eigen/tests/test_svds.py:194:37: error[parameter-already-assigned] Multiple values provided for parameter `check_usvh_A` of function `_check_svds`
- scipy/sparse/linalg/_eigen/tests/test_svds.py:194:56: error[parameter-already-assigned] Multiple values provided for parameter `check_svd` of function `_check_svds`
- scipy/sparse/linalg/_eigen/tests/test_svds.py:303:33: error[parameter-already-assigned] Multiple values provided for parameter `which` of function `_check_svds`
- scipy/sparse/linalg/_eigen/tests/test_svds.py:303:46: error[parameter-already-assigned] Multiple values provided for parameter `atol` of function `_check_svds`
- scipy/sparse/linalg/_eigen/tests/test_svds.py:303:57: error[parameter-already-assigned] Multiple values provided for parameter `rtol` of function `_check_svds`
- scipy/sparse/linalg/_eigen/tests/test_svds.py:436:35: error[parameter-already-assigned] Multiple values provided for parameter `atol` of function `_check_svds`
- scipy/sparse/linalg/_eigen/tests/test_svds.py:437:35: error[parameter-already-assigned] Multiple values provided for parameter `atol` of function `_check_svds`
- scipy/spatial/tests/test_distance.py:429:13: error[no-matching-overload] No overload of function `cdist` matches arguments
- scipy/spatial/tests/test_distance.py:431:13: error[no-matching-overload] No overload of function `cdist` matches arguments
- scipy/spatial/tests/test_distance.py:433:13: error[no-matching-overload] No overload of function `cdist` matches arguments
- scipy/spatial/tests/test_distance.py:721:13: error[no-matching-overload] No overload of function `pdist` matches arguments
- scipy/spatial/tests/test_distance.py:723:13: error[no-matching-overload] No overload of function `pdist` matches arguments
- scipy/spatial/tests/test_distance.py:725:13: error[no-matching-overload] No overload of function `pdist` matches arguments
- scipy/stats/_multivariate.py:8045:46: error[parameter-already-assigned] Multiple values provided for parameter `size` of bound method `rvs`
- scipy/stats/_multivariate.py:8045:57: error[parameter-already-assigned] Multiple values provided for parameter `random_state` of bound method `rvs`
+ scipy/stats/_qmc.py:2661:61: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ scipy/stats/_qmc.py:2662:63: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ scipy/stats/_qmc.py:2663:63: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- scipy/stats/tests/test_multivariate.py:4993:68: error[parameter-already-assigned] Multiple values provided for parameter `size` of bound method `rvs`
- scipy/stats/tests/test_multivariate.py:4994:46: error[parameter-already-assigned] Multiple values provided for parameter `random_state` of bound method `rvs`
- Found 8103 diagnostics
+ Found 8042 diagnostics

No memory usage changes detected ✅

@dhruvmanila dhruvmanila marked this pull request as ready for review January 22, 2026 15:02
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 22, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
parameter-already-assigned 0 120 0
unused-ignore-comment 21 0 0
no-matching-overload 0 13 0
invalid-argument-type 0 7 3
invalid-await 0 2 6
invalid-return-type 4 0 4
invalid-assignment 0 0 5
possibly-missing-attribute 0 3 1
unresolved-attribute 0 0 2
Total 25 145 21

Full report with detailed diff (timing results)

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment on lines +795 to +798
# Explicit keyword argument takes precedence over variable-length variadic expansion.
# The list unpacking should only fill `a` and `b`, leaving `c` for the keyword argument.
def _(args: list[str]) -> None:
f(*args, c=1.0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could consider still flagging this as a separate error code? Since the length of the args iterable is unknown, we cannot verify that the call will definitely succeed; some users who want very strict typing might still want to know about that.

I agree that we should err on the side of leniency here, though -- if we did have a separate error code for that, it should definitely be disabled by default. It's too strict for most users.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we were being consistent about the strict version, it would go beyond what main currently does -- really any * unpacking of anything other than a fixed-length tuple, to any function which doesn't take *args, is a call we can't verify is correct, which the strict diagnostic should be emitted on. I definitely think this is a separate (and low priority) feature, not something we should do in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. I'll open a separate tracking issue for this.

@dhruvmanila dhruvmanila merged commit 5770a36 into main Jan 26, 2026
50 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/unpack-arg branch January 26, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parameter-already-assigned when unpacking list in function call

4 participants