What's New in astroid 4.1.0?
Release date: 2026-02-08
-
Add support for equality constraints (
==,!=) in inference.
Closes pylint-dev/pylint#3632
Closes pylint-dev/pylint#3633 -
Ensure
ast.JoinedStrnodes areUninferablewhen theast.FormattedValueis
Uninferable. This preventsunexpected-keyword-argmessages in Pylint
where theUninferablestring appeared in function arguments that were
constructed dynamically.Closes pylint-dev/pylint#10822
-
Add support for type constraints (
isinstance(x, y)) in inference.Closes pylint-dev/pylint#1162
Closes pylint-dev/pylint#4635
Closes pylint-dev/pylint#10469 -
Make
type.__new__()raise clear errors instead of returningNone -
Move object dunder methods from
FunctionModeltoObjectModelto make them
available on all object types, not just functions.Closes #2742
Closes #2741
Closes pylint-dev/pylint#6094 -
linenoandend_linenoare now available onArguments. -
Add helper to iterate over all annotations nodes of function arguments,
Arguments.get_annotations().Refs #2860
-
Skip direct parent when determining the
Decoratorframe. -
Add simple command line interface for astroid to output generated AST.
Use withpython -m astroid. -
Fix incorrect type inference for
super().method()calls that returnSelf.
Previously, astroid would infer the parent class type instead of the child class type,
causing pylint E1101 false positives in method chaining scenarios.Closes #457
-
Add missing
dtypeandcastingparameters tonumpy.concatenatebrain.Closes #2870
-
Fix ability to detect .py modules inside PATH directories on Windows
described by a UNC path with a trailing backslash (\)- Example: modutils.modpath_from_file(filename=r"\Mac\Code\tests\test_resources.py", path=["\mac\code"]) == ['tests', 'test_resources']
-
Fix
random.sampleinference crash when sequence contains uninferable elements.Closes #2518
-
Fix
random.samplecrash when cloningClassDeforFunctionDefnodes.Closes #2923