Skip to content

Upgrade astroid to 4.3.0 - #11234

Draft
Pierre-Sassoulas wants to merge 2 commits into
pylint-dev:mainfrom
Pierre-Sassoulas:upgrade-astroid-4.3.0
Draft

Upgrade astroid to 4.3.0#11234
Pierre-Sassoulas wants to merge 2 commits into
pylint-dev:mainfrom
Pierre-Sassoulas:upgrade-astroid-4.3.0

Conversation

@Pierre-Sassoulas

@Pierre-Sassoulas Pierre-Sassoulas commented Aug 7, 2026

Copy link
Copy Markdown
Member

Type of Changes

Type
🐛 Bug fix

Description

Upgrade astroid to 4.3.0 and add regression tests plus changelog fragments for the pylint issues fixed by the astroid 4.2/4.3 line.

Fixed in astroid 4.3.0 (verified with new regression tests):

  • Crash on a functional namedtuple whose field name changes under NFKC normalization
  • pylint: disable at the start of an else block now works (block_range considers else its own block)
  • Crash (AstroidBuildingError) when inheriting from a generic dataclass rebinding __init__ in __init_subclass__

Fixed earlier in the astroid 4.2/4.3 line, verified fixed now and covered by new regression tests:

  • False positive no-name-in-module with a module alias shadowing its base module and a call to .format()
  • False positive unnecessary-lambda with **kwargs from an if-else expression
  • False positive unused-variable for the dataclass _HAS_DEFAULT_FACTORY sentinel
  • False positive invalid-name for TypeAlias aliases in TYPE_CHECKING blocks

Verified fixed but not covered by a regression test (need third-party packages or multi-module setups):

  • False positive unexpected-keyword-argument for numpy.concatenate(..., dtype=...) (numpy not installed on CI)
  • False positive invalid-enum-extension for member-less enums from another module
  • False positive syntax-error for badly placed type annotations / multi-line type comments

Still not fixed with astroid 4.3.0 (checked, left open): #7688, #9259, #4944, #4908, #10460, #11115, #10471, #9622, #4018, #1480, #436, #7820, #8072, #5321, #9989, #10238, #4920, #7240.

#7240 (no-member inside comprehensions in platform-guarded branches) initially looked fixed, but the Windows CI jobs proved otherwise: the false positive is only observable when the guarded branch is unreachable on the running platform, so the linux-only check was vacuous. Its regression test and fragment were removed again.

Closes #872
Closes #3556
Closes #3757
Closes #6887
Closes #7647
Closes #8746
Closes #9258
Closes #10193
Closes #10519
Closes #10548
Closes #11013

@Pierre-Sassoulas Pierre-Sassoulas added this to the 4.1.0 milestone Aug 7, 2026
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.34%. Comparing base (7f0d9a7) to head (f1b8366).
⚠️ Report is 96 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11234      +/-   ##
==========================================
- Coverage   96.35%   96.34%   -0.01%     
==========================================
  Files         178      178              
  Lines       19932    19932              
==========================================
- Hits        19205    19204       -1     
- Misses        727      728       +1     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add regression tests and changelog fragments for the issues fixed by
the astroid 4.2/4.3 line.
On Windows the platform guard is False and no-member is still emitted
for names used inside comprehensions in the unreachable branch. The
linux-only verification was vacuous because the branch was reachable
there. Reproduced on linux with a win32 guard and os.startfile.
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🤖 Effect of this PR on checked open source code: 🤖

Effect on astropy:

New messages:

Details
  1. no-member:
    Instance of 'BaseData' has no 'is_multiline' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/daophot.py#L60
  2. no-member:
    Instance of 'BaseData' has no 'first_block' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/daophot.py#L66
  3. not-callable:
    self.header.start_line is not callable
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/latex.py#L193
  4. no-member:
    Instance of 'BaseHeader' has no '_line_fields' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/tdat.py#L660
  5. no-member:
    Instance of 'BaseHeader' has no 'position_line' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/fixedwidth.py#L291
  6. no-member:
    Instance of 'BaseHeader' has no 'position_char' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/io/ascii/fixedwidth.py#L292
  7. invalid-sequence-index:
    Sequence index is not an int, slice, or instance with index
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L2003

Removed messages:

Details
  1. no-member:
    Class 'fget' has no 'wrapped' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/decorators.py#L859
  2. no-member:
    Class 'fget' has no 'wrapped' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/decorators.py#L865
  3. using-constant-test:
    Using a conditional statement with a constant value
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/decorators.py#L959
  4. using-constant-test:
    Using a conditional statement with a constant value
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/utils/decorators.py#L969
  5. no-member:
    Instance of 'BaseRepresentation' has no 'lon' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L304
  6. no-member:
    Instance of 'BaseRepresentation' has no 'lat' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L305
  7. no-member:
    Instance of 'BaseRepresentation' has no 'distance' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L306
  8. no-member:
    Instance of 'BaseRepresentation' has no 'lon' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L614
  9. no-member:
    Instance of 'BaseRepresentation' has no 'lat' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L615
  10. no-member:
    Instance of 'BaseRepresentation' has no 'phi' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L816
  11. no-member:
    Instance of 'BaseRepresentation' has no 'theta' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L817
  12. no-member:
    Instance of 'BaseRepresentation' has no 'r' member; maybe 'T'?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L818
  13. no-member:
    Instance of 'BaseRepresentation' has no 'x' member; maybe 'T'?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L1213
  14. no-member:
    Instance of 'BaseRepresentation' has no 'y' member; maybe 'T'?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L1214
  15. no-member:
    Instance of 'BaseRepresentation' has no 'z' member; maybe 'T'?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L1215
  16. no-member:
    Instance of 'BaseRepresentation' has no 'rho' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L1379
  17. no-member:
    Instance of 'BaseRepresentation' has no 'phi' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L1380
  18. no-member:
    Instance of 'BaseRepresentation' has no 'z' member; maybe 'T'?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L1381
  19. no-member:
    Instance of 'BaseRepresentation' has no 'x' member; maybe 'T'?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L2005
  20. no-member:
    Instance of 'BaseRepresentation' has no 'y' member; maybe 'T'?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L2006
  21. no-member:
    Instance of 'BaseRepresentation' has no 'z' member; maybe 'T'?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L2007
  22. no-member:
    Instance of 'BaseRepresentation' has no 'xyz' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation.py#L2258
  23. comparison-with-callable:
    Comparing against a callable, did you omit the parenthesis?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L122
  24. no-member:
    Instance of 'BaseRepresentation' has no 'lon' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L123
  25. no-member:
    Instance of 'BaseRepresentation' has no 'lat' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L124
  26. comparison-with-callable:
    Comparing against a callable, did you omit the parenthesis?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L138
  27. comparison-with-callable:
    Comparing against a callable, did you omit the parenthesis?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L139
  28. no-member:
    Instance of 'BaseRepresentation' has no 'lat' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L140
  29. no-member:
    Instance of 'BaseRepresentation' has no 'lat' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L142
  30. comparison-with-callable:
    Comparing against a callable, did you omit the parenthesis?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L189
  31. comparison-with-callable:
    Comparing against a callable, did you omit the parenthesis?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L190
  32. no-member:
    Instance of 'BaseRepresentation' has no 'lat' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L191
  33. no-member:
    Instance of 'BaseRepresentation' has no 'lat' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L193
  34. comparison-with-callable:
    Comparing against a callable, did you omit the parenthesis?
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L198
  35. no-member:
    Instance of 'BaseRepresentation' has no 'lon' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L199
  36. no-member:
    Instance of 'BaseRepresentation' has no 'lon' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L200
  37. no-member:
    Instance of 'BaseRepresentation' has no 'distance' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L201
  38. no-member:
    Instance of 'BaseRepresentation' has no 'distance' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_representation_methods.py#L202
  39. no-member:
    Instance of 'BaseRepresentation' has no 'lon' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_masked.py#L40
  40. no-member:
    Instance of 'BaseRepresentation' has no 'lat' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_masked.py#L41
  41. no-member:
    Instance of 'BaseRepresentation' has no 'distance' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_masked.py#L42
  42. no-member:
    Instance of 'BaseRepresentation' has no 'lon' member
    https://github.com/astropy/astropy/blob/1fb40bc1f22f176254ef583065aa155f53f3b414/astropy/coordinates/tests/test_masked.py#L129

Effect on music21:

🎉 Fixed false positives:

Details
  1. False positive for 'no-member' removed at
    https://github.com/cuthbertLab/music21/blob/65fe74f6584bdeed8421dc57b0452b4d364e4159/music21/pitch.py#L4364

Effect on ansible:

🎉 Fixed false positives:

Details
  1. False positive for 'using-constant-test' removed at
    https://github.com/ansible/ansible/blob/3f10c2c0a910b15675534891ca567dcde355ad8e/lib/ansible/modules/file.py#L583

Removed messages:

Details
  1. no-member:
    Class 'globals' has no 'update' member
    https://github.com/ansible/ansible/blob/3f10c2c0a910b15675534891ca567dcde355ad8e/lib/ansible/module_utils/_internal/_concurrent/_futures.py#L19
  2. redefined-variable-type:
    Redefinition of raise_from type from Exception to type
    https://github.com/ansible/ansible/blob/3f10c2c0a910b15675534891ca567dcde355ad8e/lib/ansible/_internal/_templating/_engine.py#L351

Effect on django:

Changed messages:

Details
  1. no-member:
- Instance of 'Exception' has no 'origin' member
+ Instance of 'Node' has no 'origin' member
               ^^^

New messages:

Details
  1. no-member:
    Instance of 'Node' has no 'resolve_expression' member
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/db/models/sql/query.py#L1265

Removed messages:

Details
  1. unsubscriptable-object:
    Value 'exception_group.exceptions' is unsubscriptable
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/dispatch/dispatcher.py#L62
  2. no-member:
    Instance of 'AppConfig' has no 'check_models_ready' member
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/apps/config.py#L231
  3. no-member:
    Instance of 'AppConfig' has no 'check_apps_ready' member
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/apps/config.py#L233
  4. no-member:
    Instance of 'AppConfig' has no 'check_models_ready' member
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/apps/config.py#L254
  5. no-member:
    Instance of 'AppConfig' has no 'all_models' member
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/apps/config.py#L265
  6. no-member:
    Instance of 'Exception' has no 'token' member
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/template/base.py#L1065
  7. no-member:
    Instance of 'ServerHandler' has no 'server' member
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/core/servers/basehttp.py#L150
  8. attribute-defined-outside-init:
    Attribute 'close_connection' defined outside init
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/core/servers/basehttp.py#L155
  9. unsubscriptable-object:
    Value 'exception_group.exceptions' is unsubscriptable
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/core/handlers/asgi.py#L209
  10. no-member:
    Class 'name' has no 'split' member
    https://github.com/django/django/blob/ad5ea292748246b2f07f3e379a250985c1ebcba5/django/db/migrations/loader.py#L90

Effect on pytest:

Removed messages:

Details
  1. no-member:
    Class 'mode' has no 'replace' member
    https://github.com/pytest-dev/pytest/blob/77dceaa1fd1598293a7a39a837f859620a07002f/src/_pytest/capture.py#L200

Effect on sentry:

Removed messages:

Details
  1. unsubscriptable-object:
    Value 'cache_values' is unsubscriptable
    https://github.com/getsentry/sentry/blob/7a701584e61d8a093132eb37c45fd0359c1652ee/src/sentry/hybridcloud/rpc/caching/service.py#L245

Effect on home-assistant:

Removed messages:

Details
  1. no-member:
    Class 'cause' has no 'context_mark' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/config.py#L227
  2. no-member:
    Class 'cause' has no 'context_mark' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/config.py#L227
  3. no-member:
    Class 'cause' has no 'context_mark' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/config.py#L228
  4. no-member:
    Class 'cause' has no 'context_mark' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/config.py#L228
  5. no-member:
    Class 'cause' has no 'problem_mark' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/config.py#L229
  6. no-member:
    Class 'cause' has no 'problem_mark' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/config.py#L229
  7. no-member:
    Class 'cause' has no 'problem_mark' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/config.py#L230
  8. no-member:
    Class 'cause' has no 'problem_mark' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/config.py#L230
  9. no-member:
    Instance of '_Hass' has no 'config' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/components/mqtt/config_flow.py#L1334
  10. no-member:
    Instance of '_Hass' has no 'config' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/components/mqtt/config_flow.py#L1528
  11. no-member:
    Instance of '_Hass' has no 'async_add_executor_job' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/components/homeworks/config_flow.py#L162
  12. no-member:
    Instance of '_Hass' has no 'data' member
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/components/frontend/__init__.py#L638
  13. unsubscriptable-object:
    Value 'err.exceptions' is unsubscriptable
    https://github.com/home-assistant/core/blob/9ad1356e4b3ee8c837c28dfde850fab8b6927aea/homeassistant/components/notion/coordinator.py#L138

Effect on psycopg:

Removed messages:

Details
  1. no-member:
    Class 'value' has no 'pgconn' member
    https://github.com/psycopg/psycopg/blob/e61b15ab1015d012d6f124ce2f2955bbf15a187f/psycopg/psycopg/connection.py#L134
  2. no-member:
    Class 'value' has no 'decode' member
    https://github.com/psycopg/psycopg/blob/e61b15ab1015d012d6f124ce2f2955bbf15a187f/psycopg/psycopg/pq/pq_ctypes.py#L1106

This comment was generated for commit f1b8366

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