Skip to content

Fix decoratornames for decorators without qname#3118

Open
gaoflow wants to merge 1 commit into
pylint-dev:mainfrom
gaoflow:fix-decoratornames-slice-qname
Open

Fix decoratornames for decorators without qname#3118
gaoflow wants to merge 1 commit into
pylint-dev:mainfrom
gaoflow:fix-decoratornames-slice-qname

Conversation

@gaoflow

@gaoflow gaoflow commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • skip inferred decorator objects that do not expose a callable qname() in FunctionDef.decoratornames()
  • add a regression test for @slice(0), which currently infers a Slice node and crashes while checking whether the function is a property

Fixes #3115.

Verification

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest tests/test_regrtest.py::NonRegressionTests::test_decorator_names_inference_error_leaking tests/test_regrtest.py::NonRegressionTests::test_decorator_names_skip_inferred_nodes_without_qname tests/test_regrtest.py -q
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest tests/test_scoped_nodes.py -q
  • uv run --with ruff ruff check astroid/nodes/scoped_nodes/scoped_nodes.py tests/test_regrtest.py
  • uv run --with black black --check astroid/nodes/scoped_nodes/scoped_nodes.py tests/test_regrtest.py
  • python -m compileall -q astroid/nodes/scoped_nodes/scoped_nodes.py tests/test_regrtest.py
  • git diff --check

I also tried a full local PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest -q; it reached 1979 passed but failed on local environment/optional dependency gaps (pytest-benchmark fixture missing, pkg_resources missing, numpy/pydantic brain expectations, and a symlink path test). The focused affected suites above pass.

@codspeed-hq

codspeed-hq Bot commented Jun 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 3 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing gaoflow:fix-decoratornames-slice-qname (45c8118) with main (65f1e61)

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 Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.59%. Comparing base (65f1e61) to head (45c8118).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3118   +/-   ##
=======================================
  Coverage   93.59%   93.59%           
=======================================
  Files          92       92           
  Lines       11371    11373    +2     
=======================================
+ Hits        10643    10645    +2     
  Misses        728      728           
Flag Coverage Δ
linux 93.46% <100.00%> (+<0.01%) ⬆️
pypy 93.59% <100.00%> (+<0.01%) ⬆️
windows 93.57% <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 93.29% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DanielNoord DanielNoord left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please use isintance instead of getattr

@Pierre-Sassoulas Pierre-Sassoulas added this to the 4.2.0 milestone Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: 'Slice' object has no attribute 'qname'

3 participants