Skip to content

Preserve sequence length with ambiguous elements - #3221

Open
Boulea7 wants to merge 1 commit into
pylint-dev:mainfrom
Boulea7:fix/sequence-concat-ambiguous-elements
Open

Preserve sequence length with ambiguous elements#3221
Boulea7 wants to merge 1 commit into
pylint-dev:mainfrom
Boulea7:fix/sequence-concat-ambiguous-elements

Conversation

@Boulea7

@Boulea7 Boulea7 commented Aug 13, 2026

Copy link
Copy Markdown

Type of Changes

Type
🐛 Bug fix

Description

Tuple and list concatenation expanded an element with multiple inferred values into multiple sequence items. This produced the wrong sequence length and caused downstream false positives when unpacking.

Each source element now contributes exactly one result. A unique inferred value stays precise, while an ambiguous or uninferable value becomes an unknown element.

Closes pylint-dev/pylint#2621

Verification

  • Full test suite: 2078 passed, 66 skipped, 15 xfailed
  • Inference tests: 462 passed, 7 skipped, 10 xfailed
  • Ruff, Black, mypy, Pylint, and diff checks passed
  • The downstream Pylint reproducer no longer reports unbalanced-tuple-unpacking

The complete pre-commit command could not initialize its copyright hook because git fetch could not connect to github.com on port 443. The corresponding local checks above passed.

@DanielNoord

Copy link
Copy Markdown
Collaborator

Can you rebase this and use towncrier to create the news fragment?

@codspeed-hq

codspeed-hq Bot commented Aug 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 3 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing Boulea7:fix/sequence-concat-ambiguous-elements (3739fd6) with main (04ba439)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.65%. Comparing base (04ba439) to head (3739fd6).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3221      +/-   ##
==========================================
- Coverage   93.65%   93.65%   -0.01%     
==========================================
  Files          93       93              
  Lines       11583    11581       -2     
==========================================
- Hits        10848    10846       -2     
  Misses        735      735              
Flag Coverage Δ
linux 93.51% <100.00%> (-0.01%) ⬇️
pypy 93.65% <100.00%> (-0.01%) ⬇️
windows 93.62% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
astroid/protocols.py 92.21% <100.00%> (-0.04%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Invalid report about "Possible unbalanced tuple unpacking"

2 participants