Skip to content

Fix nested Concatenate with ellipsis crash#21414

Open
cyphercodes wants to merge 1 commit intopython:masterfrom
cyphercodes:fix/paramspec-nested-concatenate-ellipsis
Open

Fix nested Concatenate with ellipsis crash#21414
cyphercodes wants to merge 1 commit intopython:masterfrom
cyphercodes:fix/paramspec-nested-concatenate-ellipsis

Conversation

@cyphercodes
Copy link
Copy Markdown

Fixes #21404.

This rejects a nested Concatenate[...] when it appears in the prefix arguments of another Concatenate, including the Concatenate[Concatenate[...], ...] crash case from the issue. The existing nested-Concatenate error path only handled the ParamSpec-prefix form, so the ellipsis form could reach Parameters(...) with another Parameters object nested inside it.

Tests:

  • pytest -n0 mypy/test/testcheck.py::TypeCheckSuite::check-parameter-specification.test -k testStackedConcatenateIsIllegal -q
  • pytest -n0 mypy/test/testcheck.py::TypeCheckSuite::check-parameter-specification.test -q
  • python -m mypy --config-file mypy_self_check.ini mypy/typeanal.py
  • python -m mypy --config-file mypy_self_check.ini -p mypy
  • pre-commit run --files mypy/typeanal.py test-data/unit/check-parameter-specification.test
  • git diff --check

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion failure crash: assert not any(isinstance(t, Parameters) for t in arg_types)

1 participant