Skip to content

Give comprehension scopes a name so qname() does not crash - #3427

Open
Pierre-Sassoulas wants to merge 2 commits into
pylint-dev:mainfrom
Pierre-Sassoulas:fix/comprehension-qname
Open

Pierre-Sassoulas wants to merge 2 commits into
pylint-dev:mainfrom
Pierre-Sassoulas:fix/comprehension-qname

Conversation

@Pierre-Sassoulas

Copy link
Copy Markdown
Member

Type of Changes

Type
✓ 🐛 Bug fix

Description

GeneratorExp, ListComp, SetComp and DictComp had no name attribute, so LocalsDictNodeNG.qname() raised AttributeError on them. Use the CPython code names, as Lambda already does with . This also shows the name in their repr, e.g. <ListComp. l.1 at 0x...>.

GeneratorExp, ListComp, SetComp and DictComp had no name attribute, so
LocalsDictNodeNG.qname() raised AttributeError on them. Use the CPython
code names, as Lambda already does with <lambda>. This also shows the
name in their repr, e.g. <ListComp.<listcomp> l.1 at 0x...>.
@Pierre-Sassoulas Pierre-Sassoulas added this to the 4.4.0 milestone Oct 22, 2026
@codspeed

codspeed Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 3 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing Pierre-Sassoulas:fix/comprehension-qname (d6342fe) with main (b5e78cd)

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 Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.15%. Comparing base (b5e78cd) to head (d6342fe).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3427   +/-   ##
=======================================
  Coverage   91.15%   91.15%           
=======================================
  Files          93       93           
  Lines       11800    11804    +4     
  Branches     1938     1938           
=======================================
+ Hits        10756    10760    +4     
  Misses        735      735           
  Partials      309      309           
Flag Coverage Δ
linux 90.83% <100.00%> (+<0.01%) ⬆️
pypy 91.15% <100.00%> (+<0.01%) ⬆️
windows 90.99% <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/nodes/scoped_nodes/scoped_nodes.py 90.86% <100.00%> (+0.02%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant