NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #500 most downloaded on PyPI
An abstract syntax tree for Python with inference support.
Last release 4 days ago
30 Sep 2026
Ships fairly regularly
a new release about every 4 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
3 versions withdrawn
withdrawn after publishing
13 years old
193 releases · first in 2013
Preserve the length of inferred list and tuple concatenations when an element has multiple possible values. An ambiguous or uninferable element is now
Release date: 2026-09-30
Preserve the length of inferred list and tuple concatenations when an element
has multiple possible values. An ambiguous or uninferable element is now
represented as unknown instead of being expanded into multiple sequence items.
Refs #3221
Closes pylint-dev/pylint#2621
Fix TypeError in ClassDef.getitem when __class_getitem__ is uninferable.
Closes #3312
Fix AssertionError in NodeNG.root() when inferring Class.__bases__, which previously returned a parentless Tuple.
Closes pylint-dev/pylint#11491
Fix a crash when a namedtuple or Enum type name or field name contains str.format markup, as in namedtuple("{0}", "abc") . The name is interpolated in
One column per quarter.
Release date: 2026-09-25
Fix a crash when a namedtuple or Enum type name or field name
contains str.format markup, as in namedtuple("{0}", "abc"). The name
is interpolated into an error message that astroid then reformats, so
building the message raised IndexError. Inference now falls back to its
default.
Closes #3199
Infer a functional TypeVar or NewType whose name is not an identifier
without splicing that name into the synthesized class source. A crafted value
such as TypeVar("T(Base): #") no longer breaks out of the identifier
position to inject bases or a body; the name is assigned to the class verbatim.
Refs #3217
Raise InferenceError instead of crashing with IndexError when a class
uses six.with_metaclass() with no positional metaclass argument, both while
building the module and when the call is inferred.
Refs #3248
ClassDef.slots() no longer crashes on a class that declares a PEP 695
type parameter literally named __slots__ (e.g. class C[__slots__]:).
The type parameter's TypeVar node was mistaken for the class's actual
__slots__ value; slots() now returns None for such classes
instead of raising AttributeError.
Refs #3258
Fix a crash when inferring an f-string or str.format() call whose c format
spec gets an out-of-range code point, such as f"{-1:c}". These now infer to
Uninferable, like the %c case fixed in #3254.
Closes #3301
The args attribute of an exception instance is now inferred as a tuple
instance of unknown contents instead of a known empty tuple, so unpacking
exc.args no longer looks unbalanced.
Closes pylint-dev/pylint#11312
Fix inference of the attributes of a namedtuple created with rename=True . The renamed fields were applied to _fields and to the class body, but the i
Release date: 2026-08-17
Fix inference of the attributes of a namedtuple created with
rename=True. The renamed fields were applied to _fields and to the
class body, but the instance kept the field names as written, so an instance
of namedtuple("Tuple", "abc def", rename=True) was inferred as having a
def attribute instead of _1, and duplicate field names collapsed into
a single attribute instead of being renamed.
Closes #242
Version 4.2.0 was skipped: a v4.2.0 tag was created by mistake during an aborted release attempt, so the changes from the 4.2.0 betas are released as
Release date: 2026-08-07
Version 4.2.0 was skipped: a v4.2.0 tag was created by mistake during an
aborted release attempt, so the changes from the 4.2.0 betas are released
as 4.3.0.
Fix a crash on a functional namedtuple whose field name changes under NFKC
normalization, such as namedtuple("mu", ["µ"]). Python normalizes
identifiers, so the parsed class stores the field under "μ" while the
brain looked it up as written, raising KeyError on a definition that
namedtuple itself accepts.
Closes pylint-dev/pylint#8746
Fix inference of a method's first argument (self or cls) when the
method's return value is stored on an unrelated object. This avoids inferring
cls as the caller's class when indexing a tuple returned by a
classmethod such as A.c()[0].
Closes pylint-dev/pylint#11101
super() with no argument now resolves against the class of the object the
method was called on, instead of the class the method is written in. One consequence
is that a typing.Self return value survives a chain of super() calls.
Closes #2852
Closes pylint-dev/pylint#10807
typing.overload stubs no longer shadow the implementation when a special
method is looked up in the MRO.
Closes #2448
Fix a crash when the field names of a functional Enum or namedtuple
call are bytes, as in Enum("", b""). Such a definition is invalid, so
inference now falls back to its default instead of raising TypeError.
Closes #3189
Fix a crash when the body of a typing.NamedTuple subclass contains an
assignment whose target is not a single name, such as cat.color = "black",
basket[0] = "apple" or apple, banana = "red", "yellow". The names bound
by unpacking are now copied to the inferred class as well.
Closes #3190
Fix a crash when a binary operation involves a class whose metaclass is not a
class, as in class C(metaclass=sum) followed by C | None. The type of
such a class is a function, which has no bases, so has_known_bases() now
returns False for anything that is not a class.
Closes #3191
Fix a crash when a dataclass inherits from a dataclass that annotates
__init__ as a field, as in __init__: int. Such a base binds
__init__ to a name instead of a function, so it no longer contributes
arguments to the generated __init__.
Closes #3200
The documentation build now fails on any Sphinx warning, so a cross-reference
that does not resolve is caught by CI instead of quietly rendering as plain
text. Uninferable, Position and the BadOperationMessage classes
are documented as part of the public API, and a number of docstrings that
Sphinx could not parse were repaired.
The >>> examples in the documentation are run when the documentation is
built, so one that stops being true is noticed. Most of them could not run
before: they printed node addresses recorded in 2018, and the multi-line ones
were missing the ... continuation prompt. The example for Decorators
reported the wrong line numbers.
Fix the example in the docstring of BoolOp, which showed the node it was
copied from: astroid.extract_node("a and b") gives a BoolOp, not a
BinOp.
Names written between single backticks in the ChangeLog render as code again,
rather than as italics.
Prevent crashes while processing extension-module classes whose bases cannot
be resolved when applying enum inference transformations.
Closes pylint-dev/pylint#11179
The API documentation now covers the proxies, the objects with no node of
their own, the inference context, the manager, the object models and the
extension call signatures. The EvaluatedObject, Interpolation,
NamedExpr and TemplateStr nodes were missing from the list of nodes
and are listed now.
Add __required_keys__ and __optional_keys__ to the inferred
TypedDict base class, so subclasses no longer raise a no-member
false positive in pylint when accessing those attributes at runtime.
Closes pylint-dev/pylint#10158
Comprehension conditions now constrain the inference of names used in the
comprehension, like if statement conditions already did:
[x for x in lst if x is not None] no longer infers None for x
in the element expression.
Refs #3094
Fix isinstance() constraints only filtering the first inferred value of
a variable: checking a value made the isinstance classinfo uninferable
for the checks of the following values.
Remove Python 2 era dead code and outdated comments.
Notably: the internal TreeRebuilder constructor no longer takes a
parser_module argument.
Refs #3154
Fix inference of a starred target that is not last in a for loop, such as
for a, *b, c in .... The elements following the starred one were counted
from the target's own arity rather than from the end of the iterable, so
b was truncated whenever the iterable was longer than the target.
Add qname() method to the Slice node class, returning
"builtins.slice", so that the node can be used in contexts
that require a qualified name (e.g. pylint's basic_checker).
Closes #3115
Add brain tip for numpy.fromfile so that calls to
np.fromfile(...) are correctly inferred as returning
numpy.ndarray instead of Uninferable.
Closes #600
Add brain for decimal that gets applied if _decimal isn't available.
Removed the **kwargs argument from all infer functions.
Users upgrading their astroid versions should ensure they do no pass values other than
context to infer.
Deduplicate keys when inferring dict.fromkeys. dict.fromkeys("aab")
now infers a dict with keys "a", "b" instead of "a", "a",
"b", matching the runtime. This also stops dict.fromkeys from
materializing one Const node per character for a repeated string such as
dict.fromkeys("x" * 10 ** 8), which is a single-key dict.
Bound str/bytes and list/tuple concatenation (a + b) during inference.
Bound oversized old-style (%) string/bytes formatting during inference.
A tiny literal such as "%1000000000d" % 1 made
_infer_old_style_string_formatting eagerly build a multi-gigabyte
Const while inferring otherwise untrusted source. The width and
precision are now read out of the conversion specifiers (including *
fields) and the interpolation infers as Uninferable past 1e8,
mirroring the repetition, concatenation and str.format caps. Bytes
% formatting is routed through the same handler so it is bounded too;
small format strings keep inferring their exact value.
Fix crash (TypeError: 'UninferableBase' object is not iterable) in the
multiprocessing brain when a local package shadows the stdlib
multiprocessing module.
Closes pylint-dev/pylint#10014
Bound the number of nodes built when inferring list/set/tuple/
frozenset and dict.fromkeys from a str/bytes constant. These
built one Const node per character with no cap, so ``list(("a" * 10 ** 8)
(concatenation is not size-bounded) materialized hundreds of millions of nodes. They now fall back to the default inference past1e8`` characters,Refs #3127
Bound string/bytes multiplication ("x" * n) and integer left shifts
(1 << n) in const_infer_binary_op the same way list/tuple
multiplication and ** already are. Inferring a constant such as
"A" * 10 ** 10 previously materialized the multi-gigabyte result
eagerly; these operations now infer as Uninferable when the result
would be oversized.
Refs #3107
Bound the field width and precision when inferring str.format calls.
A template such as "{:>2000000000}".format("x") (or a width/precision
supplied through a nested {} field) previously built the padded
multi-gigabyte string eagerly during inference; such calls now infer as
Uninferable when the field size would be oversized.
Refs #3131
Remove the asname keyword argument from Import._infer and
ImportFrom._infer. The alias-to-real-name translation that
asname=True performed is now hoisted into ImportNode._infer_name,
which runs in _infer_stmts before _infer is dispatched. Direct
callers of Import.infer / ImportFrom.infer (previously the
asname=False path) now consistently resolve the lookup name as-is.
The two flows used to collapse into a single inference cache entry
because the asname kwarg was not part of the cache key, so the
second call returned the cached result of the first regardless of
which one ran. With the translation hoisted upstream, the two flows
set different lookupname values and therefore land on distinct
cache keys, eliminating the collision.
Refs pylint-dev/pylint#10193
Closes #3007
Avoid materializing a multi-gigabyte string while inferring a small literal
such as "{:>2000000000}".format("x") or f"{1.5:.2000000000f}".
_infer_str_format_call and FormattedValue._infer now yield
Uninferable when a format spec asks for a width or precision over 1e8,
mirroring the sequence/repetition caps in astroid.protocols.
Refs #3108
Fix uncaught IndentationError when parsing code whose lines end in
\r: the slice of source tokenized to compute a class or function
position is split on \n only and could be misaligned with the AST
line numbers. Such nodes now simply have no position information, as
already done when tokenize raises TokenError.
Closes #3091
Support PEP 810 lazy imports (new in Python 3.15). Import and
ImportFrom nodes gain an is_lazy integer attribute, mirroring
the ast field of the same name.
Support PEP 798 comprehension unpacking ({**d for d in dicts},
new in Python 3.15).
Fix astroid bootstrap crash on PyPy 7.3.22 (TypeError: expected str, got getset_descriptor object) by also catching TypeError from
getattr(obj, alias) in InspectBuilder.object_build. PyPy 7.3.22
raises TypeError instead of AttributeError for unset getset
descriptors like types.FunctionType.__text_signature__, which made
_astroid_bootstrapping() blow up on any call into astroid.
Shorten import astroid by deferring imports only needed on cold paths.
logging (used by modutils and raw_building solely to report
stderr/stdout captured while importing a module) and pprint (used only
to format debug __repr__ / repr_tree output) are now imported
lazily, and astroid.exceptions imports astroid.typing under
TYPE_CHECKING.
Fix AttributeError crash in starred_assigned_stmts when a starred
unpacking target is an attribute (e.g. for *o.attr, x in ...) rather
than a simple name.
Closes #2646
Fix AttributeError crash in the Arguments assigned_stmts
protocol when called without an inference context (the public
assigned_stmts API defaults context to None). Resolving a
function's first parameter dereferenced context.boundnode while the
matching context and ... guard a few lines below was missing; it now
degrades to Uninferable.
Fix AttributeError crash in ClassDef.infer_call_result when called
through the public API without a context (it defaults to None) for a
class whose metaclass defines __call__: the callee was assigned to
context.callcontext.callee without checking that a call context exists.
It is now guarded, matching the surrounding code.
Wrap assignment expressions (:=) in parentheses when emitting
as_string output so the rendered code remains syntactically valid in
contexts such as comparisons, where Python requires the walrus expression
to be parenthesized.
Closes #2668
Catch MemoryError/RecursionError (and ValueError) when validating
type comments with ast.parse. Pathological type comments produced by
fuzzers (e.g. # type: i{{{{{{{...) previously crashed parsing with a
MemoryError or RecursionError depending on the runtime; astroid now
treats them as invalid type comments and skips them, mirroring the f-string
fix from #2762.
Closes #2993
Bypass __init__ in InferenceContext.clone() and write the slots
directly. clone() is called ~85k times per pandas/frame.py pylint run;
skipping the conditional defaults shaves measurable time off the hottest
constructor in inference.
Refs #1115
Fix TypeError in brain_random when random.sample is called with a
sequence containing nodes whose __init__ does not accept lineno
(e.g. Module). The clone helper now filters init params to those the
class actually accepts.
Closes #3043
Fix RecursionError in _compute_mro() when circular class hierarchies
are created through runtime name rebinding. Circular bases are now resolved
to the original class instead of recursing.
Closes #3023
Closes pylint-dev/pylint#10821
Changed block_range to consider else its own block, allowing pylint to apply
disables to just the block.
References pylint-dev/pylint#872
Fix uncaught TokenError when building a class or function whose source
slice is malformed. tokenize.generate_tokens may raise (e.g. on an
unterminated bracket on Python < 3.12); position computation now treats such
a node as having no position information instead of crashing.
Closes #2527
str() of a constant argument now infers the actual string value instead
of always inferring "". When every inference path of the argument
resolves to Const values that stringify to the same string, infer_str
returns that string; otherwise it keeps falling back to Const("").
Closes #2994
Fix AttributeError crash when looking up a special method on a class
whose explicit metaclass infers to a non-class node (e.g. a function). Such
a metaclass has no MRO, so the dunder lookup now raises
AttributeInferenceError instead of crashing.
Closes #3063
Fix AttributeError crash in ClassDef.getitem when __class_getitem__
resolves to a non-callable node (e.g. an AssignName). getitem now
raises AstroidTypeError in that case, consistent with its documented
behaviour.
Closes #3064
Fix DuplicateBasesError crash in the enum brain when inferring an enum
class with duplicate bases (e.g. class C(enum.Enum, enum.Enum)).
infer_enum_class now catches MroError and leaves such a malformed
class untransformed.
Closes #3065
Fix InferenceError crash in ClassDef.slots() when __slots__ is
declared as an annotation without a value (e.g. __slots__: None). Such a
__slots__ cannot be inferred, so slots() now returns None.
Closes #3067
Fix TypeError crash in the enum brain when a functional Enum call
has a non-string member name (e.g. Enum("e", (1,))). Such a definition
is invalid, so inference now falls back to the default instead of crashing.
Closes #3068
Fix detecting static/class methods and inspecting IntFlag types in
GObject-based libraries (GLib, Gtk etc)
Only inject the _HAS_DEFAULT_FACTORY sentinel into a module's locals when
the generated dataclass __init__ actually references it. Parsing a module
containing a dataclass without any field(default_factory=...) no longer
exposes an unexpected _HAS_DEFAULT_FACTORY name.
Closes #2808
__func__ on a bound method that proxies its function directly,A.method.__func__ for a classmethod, or a lambda assigned to a class attributeA().lam.__func__.Closes pylint-dev/pylint#11198
Add qname() and pytype() to the TypeVar, ParamSpec,
TypeVarTuple and TypeAlias node classes, returning
"typing.TypeVar", "typing.ParamSpec", "typing.TypeVarTuple"
and "typing.TypeAliasType". PEP 695 type parameters and type aliases
are inferred as themselves, so callers that ask an inferred value for its
type crashed with an AttributeError, as FunctionDef.decoratornames()
did for @T inside class Basket[T].
Refs #3115
Infer the value of a data descriptor of a C-implemented class as unknown
instead of as a class named after the attribute. Reading such an attribute,
for instance exc.__traceback__.tb_frame or gen.gi_frame, inferred a
class, so the attributes of the value the descriptor returns were reported as
missing. raw_building.object_build_datadescriptor() now returns an
EmptyNode.
Closes pylint-dev/pylint#11218
Comprehension conditions now constrain the inference of names used in the comprehension, like if statement conditions already did: [x for x in lst if
Release date: 2026-07-27
Comprehension conditions now constrain the inference of names used in the
comprehension, like if statement conditions already did:
[x for x in lst if x is not None] no longer infers None for x
in the element expression.
Refs #3094
Fix isinstance() constraints only filtering the first inferred value of
a variable: checking a value made the isinstance classinfo uninferable
for the checks of the following values.
Fix inference of a starred target that is not last in a for loop, such as
for a, *b, c in .... The elements following the starred one were counted
from the target's own arity rather than from the end of the iterable, so
b was truncated whenever the iterable was longer than the target.
Add qname() method to the Slice node class, returning
"builtins.slice", so that the node can be used in contexts
that require a qualified name (e.g. pylint's basic_checker).
Closes #3115
Add brain tip for numpy.fromfile so that calls to
np.fromfile(...) are correctly inferred as returning
numpy.ndarray instead of Uninferable.
Closes #600
Add brain for decimal that gets applied if _decimal isn't available.
Removed the **kwargs argument from all infer functions.
Users upgrading their astroid versions should ensure they do no pass values other than
context to infer.
Deduplicate keys when inferring dict.fromkeys. dict.fromkeys("aab")
now infers a dict with keys "a", "b" instead of "a", "a",
"b", matching the runtime. This also stops dict.fromkeys from
materializing one Const node per character for a repeated string such as
dict.fromkeys("x" * 10 ** 8), which is a single-key dict.
Fix crash (TypeError: 'UninferableBase' object is not iterable) in the
multiprocessing brain when a local package shadows the stdlib
multiprocessing module.
Closes pylint-dev/pylint#10014
Bound string/bytes multiplication ("x" * n) and integer left shifts
(1 << n) in const_infer_binary_op the same way list/tuple
multiplication and ** already are. Inferring a constant such as
"A" * 10 ** 10 previously materialized the multi-gigabyte result
eagerly; these operations now infer as Uninferable when the result
would be oversized.
Refs #3107
Remove the asname keyword argument from Import._infer and
ImportFrom._infer. The alias-to-real-name translation that
asname=True performed is now hoisted into ImportNode._infer_name,
which runs in _infer_stmts before _infer is dispatched. Direct
callers of Import.infer / ImportFrom.infer (previously the
asname=False path) now consistently resolve the lookup name as-is.
The two flows used to collapse into a single inference cache entry
because the asname kwarg was not part of the cache key, so the
second call returned the cached result of the first regardless of
which one ran. With the translation hoisted upstream, the two flows
set different lookupname values and therefore land on distinct
cache keys, eliminating the collision.
Refs pylint-dev/pylint#10193
Closes #3007
Fix uncaught IndentationError when parsing code whose lines end in
\r: the slice of source tokenized to compute a class or function
position is split on \n only and could be misaligned with the AST
line numbers. Such nodes now simply have no position information, as
already done when tokenize raises TokenError.
Closes #3091
Support PEP 810 lazy imports (new in Python 3.15). Import and
ImportFrom nodes gain a lazy boolean attribute.
Support PEP 798 comprehension unpacking ({**d for d in dicts},
new in Python 3.15).
Fix astroid bootstrap crash on PyPy 7.3.22 (TypeError: expected str, got getset_descriptor object) by also catching TypeError from
getattr(obj, alias) in InspectBuilder.object_build. PyPy 7.3.22
raises TypeError instead of AttributeError for unset getset
descriptors like types.FunctionType.__text_signature__, which made
_astroid_bootstrapping() blow up on any call into astroid.
Shorten import astroid by deferring imports only needed on cold paths.
logging (used by modutils and raw_building solely to report
stderr/stdout captured while importing a module) and pprint (used only
to format debug __repr__ / repr_tree output) are now imported
lazily, and astroid.exceptions imports astroid.typing under
TYPE_CHECKING.
Fix AttributeError crash in starred_assigned_stmts when a starred
unpacking target is an attribute (e.g. for *o.attr, x in ...) rather
than a simple name.
Closes #2646
Fix AttributeError crash in the Arguments assigned_stmts
protocol when called without an inference context (the public
assigned_stmts API defaults context to None). Resolving a
function's first parameter dereferenced context.boundnode while the
matching context and ... guard a few lines below was missing; it now
degrades to Uninferable.
Fix AttributeError crash in ClassDef.infer_call_result when called
through the public API without a context (it defaults to None) for a
class whose metaclass defines __call__: the callee was assigned to
context.callcontext.callee without checking that a call context exists.
It is now guarded, matching the surrounding code.
Wrap assignment expressions (:=) in parentheses when emitting
as_string output so the rendered code remains syntactically valid in
contexts such as comparisons, where Python requires the walrus expression
to be parenthesized.
Closes #2668
Catch MemoryError/RecursionError (and ValueError) when validating
type comments with ast.parse. Pathological type comments produced by
fuzzers (e.g. # type: i{{{{{{{...) previously crashed parsing with a
MemoryError or RecursionError depending on the runtime; astroid now
treats them as invalid type comments and skips them, mirroring the f-string
fix from #2762.
Closes #2993
Fix TypeError in brain_random when random.sample is called with a
sequence containing nodes whose __init__ does not accept lineno
(e.g. Module). The clone helper now filters init params to those the
class actually accepts.
Closes #3043
Fix RecursionError in _compute_mro() when circular class hierarchies
are created through runtime name rebinding. Circular bases are now resolved
to the original class instead of recursing.
Closes #3023
Closes pylint-dev/pylint#10821
Changed block_range to consider else its own block, allowing pylint to apply
disables to just the block.
References pylint-dev/pylint#872
Fix uncaught TokenError when building a class or function whose source
slice is malformed. tokenize.generate_tokens may raise (e.g. on an
unterminated bracket on Python < 3.12); position computation now treats such
a node as having no position information instead of crashing.
Closes #2527
str() of a constant argument now infers the actual string value instead
of always inferring "". When every inference path of the argument
resolves to Const values that stringify to the same string, infer_str
returns that string; otherwise it keeps falling back to Const("").
Closes #2994
Fix AttributeError crash when looking up a special method on a class
whose explicit metaclass infers to a non-class node (e.g. a function). Such
a metaclass has no MRO, so the dunder lookup now raises
AttributeInferenceError instead of crashing.
Closes #3063
Fix AttributeError crash in ClassDef.getitem when __class_getitem__
resolves to a non-callable node (e.g. an AssignName). getitem now
raises AstroidTypeError in that case, consistent with its documented
behaviour.
Closes #3064
Fix DuplicateBasesError crash in the enum brain when inferring an enum
class with duplicate bases (e.g. class C(enum.Enum, enum.Enum)).
infer_enum_class now catches MroError and leaves such a malformed
class untransformed.
Closes #3065
Fix InferenceError crash in ClassDef.slots() when __slots__ is
declared as an annotation without a value (e.g. __slots__: None). Such a
__slots__ cannot be inferred, so slots() now returns None.
Closes #3067
Fix TypeError crash in the enum brain when a functional Enum call
has a non-string member name (e.g. Enum("e", (1,))). Such a definition
is invalid, so inference now falls back to the default instead of crashing.
Closes #3068
Fix detecting static/class methods and inspecting IntFlag types in
GObject-based libraries (GLib, Gtk etc)
Note that this changelog also includes changes from previous betas.
Removed the kwargs argument from all infer functions. Users upgrading their astroid versions should ensure they do no pass values other than context t
Release date: 2026-07-04
Removed the **kwargs argument from all infer functions.
Users upgrading their astroid versions should ensure they do no pass values other than
context to infer.
Fix crash (TypeError: 'UninferableBase' object is not iterable) in the
multiprocessing brain when a local package shadows the stdlib
multiprocessing module.
Closes pylint-dev/pylint#10014
Bound string/bytes multiplication ("x" * n) and integer left shifts
(1 << n) in const_infer_binary_op the same way list/tuple
multiplication and ** already are. Inferring a constant such as
"A" * 10 ** 10 previously materialized the multi-gigabyte result
eagerly; these operations now infer as Uninferable when the result
would be oversized.
Refs #3107
Remove the asname keyword argument from Import._infer and
ImportFrom._infer. The alias-to-real-name translation that
asname=True performed is now hoisted into ImportNode._infer_name,
which runs in _infer_stmts before _infer is dispatched. Direct
callers of Import.infer / ImportFrom.infer (previously the
asname=False path) now consistently resolve the lookup name as-is.
The two flows used to collapse into a single inference cache entry
because the asname kwarg was not part of the cache key, so the
second call returned the cached result of the first regardless of
which one ran. With the translation hoisted upstream, the two flows
set different lookupname values and therefore land on distinct
cache keys, eliminating the collision.
Refs pylint-dev/pylint#10193
Closes #3007
Fix uncaught IndentationError when parsing code whose lines end in
\r: the slice of source tokenized to compute a class or function
position is split on \n only and could be misaligned with the AST
line numbers. Such nodes now simply have no position information, as
already done when tokenize raises TokenError.
Closes #3091
Fix astroid bootstrap crash on PyPy 7.3.22 (TypeError: expected str, got getset_descriptor object) by also catching TypeError from
getattr(obj, alias) in InspectBuilder.object_build. PyPy 7.3.22
raises TypeError instead of AttributeError for unset getset
descriptors like types.FunctionType.__text_signature__, which made
_astroid_bootstrapping() blow up on any call into astroid.
Shorten import astroid by deferring imports only needed on cold paths.
logging (used by modutils and raw_building solely to report
stderr/stdout captured while importing a module) and pprint (used only
to format debug __repr__ / repr_tree output) are now imported
lazily, and astroid.exceptions imports astroid.typing under
TYPE_CHECKING.
Fix AttributeError crash in starred_assigned_stmts when a starred
unpacking target is an attribute (e.g. for *o.attr, x in ...) rather
than a simple name.
Closes #2646
Fix AttributeError crash in the Arguments assigned_stmts
protocol when called without an inference context (the public
assigned_stmts API defaults context to None). Resolving a
function's first parameter dereferenced context.boundnode while the
matching context and ... guard a few lines below was missing; it now
degrades to Uninferable.
Fix AttributeError crash in ClassDef.infer_call_result when called
through the public API without a context (it defaults to None) for a
class whose metaclass defines __call__: the callee was assigned to
context.callcontext.callee without checking that a call context exists.
It is now guarded, matching the surrounding code.
Wrap assignment expressions (:=) in parentheses when emitting
as_string output so the rendered code remains syntactically valid in
contexts such as comparisons, where Python requires the walrus expression
to be parenthesized.
Closes #2668
Catch MemoryError/RecursionError (and ValueError) when validating
type comments with ast.parse. Pathological type comments produced by
fuzzers (e.g. # type: i{{{{{{{...) previously crashed parsing with a
MemoryError or RecursionError depending on the runtime; astroid now
treats them as invalid type comments and skips them, mirroring the f-string
fix from #2762.
Closes #2993
Fix TypeError in brain_random when random.sample is called with a
sequence containing nodes whose __init__ does not accept lineno
(e.g. Module). The clone helper now filters init params to those the
class actually accepts.
Closes #3043
Fix RecursionError in _compute_mro() when circular class hierarchies
are created through runtime name rebinding. Circular bases are now resolved
to the original class instead of recursing.
Closes #3023
Closes pylint-dev/pylint#10821
Changed block_range to consider else its own block, allowing pylint to apply
disables to just the block.
References pylint-dev/pylint#872
Fix uncaught TokenError when building a class or function whose source
slice is malformed. tokenize.generate_tokens may raise (e.g. on an
unterminated bracket on Python < 3.12); position computation now treats such
a node as having no position information instead of crashing.
Closes #2527
str() of a constant argument now infers the actual string value instead
of always inferring "". When every inference path of the argument
resolves to Const values that stringify to the same string, infer_str
returns that string; otherwise it keeps falling back to Const("").
Closes #2994
Fix AttributeError crash when looking up a special method on a class
whose explicit metaclass infers to a non-class node (e.g. a function). Such
a metaclass has no MRO, so the dunder lookup now raises
AttributeInferenceError instead of crashing.
Closes #3063
Fix AttributeError crash in ClassDef.getitem when __class_getitem__
resolves to a non-callable node (e.g. an AssignName). getitem now
raises AstroidTypeError in that case, consistent with its documented
behaviour.
Closes #3064
Fix DuplicateBasesError crash in the enum brain when inferring an enum
class with duplicate bases (e.g. class C(enum.Enum, enum.Enum)).
infer_enum_class now catches MroError and leaves such a malformed
class untransformed.
Closes #3065
Fix InferenceError crash in ClassDef.slots() when __slots__ is
declared as an annotation without a value (e.g. __slots__: None). Such a
__slots__ cannot be inferred, so slots() now returns None.
Closes #3067
Fix TypeError crash in the enum brain when a functional Enum call
has a non-string member name (e.g. Enum("e", (1,))). Such a definition
is invalid, so inference now falls back to the default instead of crashing.
Closes #3068
Note that this changelog also includes changes from previous betas.
Fix RecursionError in _compute_mro() when circular class hierarchies are created through runtime name rebinding. Circular bases are now resolved to th
Release date: 2026-04-24
Fix RecursionError in _compute_mro() when circular class hierarchies
are created through runtime name rebinding. Circular bases are now resolved
to the original class instead of recursing.
Closes #3023
Closes pylint-dev/pylint#10821
Changed block_range to consider else its own block, allowing pylint to apply
disables to just the block.
References pylint-dev/pylint#872
Note that this changelog also includes changes from previous betas.
Fix RecursionError in _compute_mro() when circular class hierarchies are created through runtime name rebinding. Circular bases are now resolved to th
Release date: 2026-04-23
Fix RecursionError in _compute_mro() when circular class hierarchies
are created through runtime name rebinding. Circular bases are now resolved
to the original class instead of recursing.
Closes #3023
Closes pylint-dev/pylint#10821
Changed block_range to consider else its own block, allowing pylint to apply
disables to just the block.
References pylint-dev/pylint#872
Note that this changelog also includes changes from previous betas.
Release date: Release date: 2026-03-23
Release date: Release date: 2026-03-23
Changed block_range to consider else its own block, allowing pylint to apply
disables to just the block.
References pylint-dev/pylint#872
Fix crash accessing property fset in generic classes with type annotations. Closes #2996
Release date: 2026-03-22
Fix crash accessing property fset in generic classes with type annotations.
Closes #2996
Fix infinite recursion caused by cyclic inference in Constraint.
Fix RecursionError in _compute_mro() when circular class hierarchies
are created through runtime name rebinding. Circular bases are now resolved
to the original class instead of recursing.
Closes #2967
Closes pylint-dev/pylint#10821
Fix DuplicateBasesError crash in dataclass transform when a class has
duplicate bases in its MRO (e.g., Protocol appearing both directly and
indirectly). Catch MroError at .mro() call sites in
brain_dataclasses.py, consistent with the existing pattern elsewhere.
Closes #2628
Fix FunctionModel returning descriptor attributes for builtin functions.
Closes #2743
Catch MemoryError when inferring f-strings with extremely large format
widths (e.g. f'{0:11111111111}') so that inference yields Uninferable
instead of crashing.
Closes #2762
Fix ValueError in __str__/repr and error messages when nodes have
extreme values (very long identifiers or large integers). Clamp pprint width
to a minimum of 1 and truncate oversized values in error messages.
Closes #2764
Let UnboundMethodModel inherit from FunctionModel to improve inference of dunder methods for unbound methods.
Release date: 2026-02-22
Add support for equality constraints (==, !=) in inference. Closes pylint-dev/pylint#3632 Closes pylint-dev/pylint#3633
Release date: 2026-02-08
Add support for equality constraints (==, !=) in inference.
Closes pylint-dev/pylint#3632
Closes pylint-dev/pylint#3633
Ensure ast.JoinedStr nodes are Uninferable when the ast.FormattedValue is
Uninferable. This prevents unexpected-keyword-arg messages in Pylint
where the Uninferable string 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 returning None
Move object dunder methods from FunctionModel to ObjectModel to make them
available on all object types, not just functions.
Closes #2742 Closes #2741 Closes pylint-dev/pylint#6094
lineno and end_lineno are now available on Arguments.
Add helper to iterate over all annotations nodes of function arguments,
Arguments.get_annotations().
Refs #2860
Skip direct parent when determining the Decorator frame.
Refs pylint-dev/pylint#8425
Add simple command line interface for astroid to output generated AST.
Use with python -m astroid.
Fix incorrect type inference for super().method() calls that return Self.
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 dtype and casting parameters to numpy.concatenate brain.
Closes #2870
Fix ability to detect .py modules inside PATH directories on Windows
described by a UNC path with a trailing backslash (\)
Fix random.sample inference crash when sequence contains uninferable elements.
Closes #2518
Fix random.sample crash when cloning ClassDef or FunctionDef nodes.
Closes #2923
Fix is_namespace() crash when search locations contain pathlib.Path objects.
Release date: 2026-02-07
Fix is_namespace() crash when search locations contain pathlib.Path objects.
Closes #2942
Fix inference of IfExp (ternary expression) nodes to avoid prematurely narrowing results in the face of inference ambiguity.
Release date: 2026-01-03
Fix inference of IfExp (ternary expression) nodes to avoid prematurely narrowing
results in the face of inference ambiguity.
Closes #2899
Fix base class inference for dataclasses using the PEP 695 typing syntax.
Refs pylint-dev/pylint#10788
Handle FunctionDef blockstart_tolineno edge cases correctly.
Release date: 2025-11-09
Handle FunctionDef blockstart_tolineno edge cases correctly.
Refs #2880
Add HTTPMethod enum support to brain module for Python 3.11+.
Refs pylint-dev/pylint#10624 Closes #2877
Suppress SyntaxWarning for invalid escape sequences and return in finally on Python 3.14 when parsing modules.
Release date: 2025-10-11
Suppress SyntaxWarning for invalid escape sequences and return in finally on
Python 3.14 when parsing modules.
Assign Import and ImportFrom nodes to module locals if used with global.
Closes pylint-dev/pylint#10632
Handle deprecated bool(NotImplemented) cast in const nodes.
Release date: 2025-10-05
Support constraints from ternary expressions in inference.
Closes pylint-dev/pylint#9729
Handle deprecated bool(NotImplemented) cast in const nodes.
Add support for boolean truthiness constraints (x, not x) in inference.
Closes pylint-dev/pylint#9515
Fix false positive invalid-name on attrs classes with ClassVar annotated variables.
Closes pylint-dev/pylint#10525
Prevent crash when parsing deeply nested parentheses causing MemoryError in python's built-in ast.
Closes #2643
Fix crash when inferring namedtuple with invalid field name looking like f-string formatting.
Closes #2519
Fix false positive no-member in except * handler.
Closes pylint-dev/pylint#9056
Fix crash when comparing invalid dict literal
Closes #2522
Removed internal functions infer_numpy_member, name_looks_like_numpy_member, and
attribute_looks_like_numpy_member from astroid.brain.brain_numpy_utils.
To alleviate circular imports, the manager argument to AstroidBuilder() is now required.
Constants now have a parent of nodes.SYNTHETIC_ROOT.
Fix crashes with large positive and negative list multipliers.
Closes #2521 Closes #2523
Fix precedence of path arg in modpath_from_file_with_callback to be higher than sys.path
Following a deprecation period, the future argument was removed from statement() and frame().
Improve consistency of JoinedStr inference by not raising InferenceError and
returning either Uninferable or a fully resolved Const.
Closes #2621
Fix crash when typing._alias() call is missing arguments.
Closes #2513
Remove support for Python 3.9 (and constant PY310_PLUS).
Include subclasses of standard property classes as property decorators
Closes #10377
Modify astroid.bases and tests.test_nodes to reflect that enum.property was added in Python 3.11, not 3.10
Fix incorrect result in _get_relative_base_path when the target directory name starts with the base path
Closes #2608
The brain for nose was dropped. nose has been deprecated for 10 years and the brain required some maintenance.
Refs #2765
Fix a crash when the root of a node is not a module but is unknown.
Closes #2672
Add basic support for ast.TemplateStr and ast.Interpolationadded in Python 3.14.
Refs #2789
Add support for type parameter defaults added in Python 3.13.
Improve as_string() representation for TypeVar, ParamSpec and TypeVarTuple nodes, as well as
type parameter in ClassDef, FuncDef and TypeAlias nodes (PEP 695).
Astroid now correctly supports the exceptions attribute of ExceptionGroup.
Closes pylint-dev/pylint#8985 Closes pylint-dev/pylint#10558
Deprecate importing node classes from astroid directly. This will be removed in v5.
It's recommended to import them from astroid.nodes instead.
Refs #2837
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Following a deprecation period, the future argument was removed from statement() and frame().
Removed internal functions infer_numpy_member, name_looks_like_numpy_member, and
attribute_looks_like_numpy_member from astroid.brain.brain_numpy_utils.
To alleviate circular imports, the manager argument to AstroidBuilder() is now required.
Constants now have a parent of nodes.SYNTHETIC_ROOT.
Fix crashes with large positive and negative list multipliers.
Closes #2521 Closes #2523
Fix precedence of path arg in modpath_from_file_with_callback to be higher than sys.path
Following a deprecation period, the future argument was removed from statement() and frame().
Improve consistency of JoinedStr inference by not raising InferenceError and
returning either Uninferable or a fully resolved Const.
Closes #2621
Fix crash when typing._alias() call is missing arguments.
Closes #2513
Remove support for Python 3.9 (and constant PY310_PLUS).
Include subclasses of standard property classes as property decorators
Closes pylint-dev/pylint#10377
Modify astroid.bases and tests.test_nodes to reflect that enum.property was added in Python 3.11, not 3.10
Fix incorrect result in _get_relative_base_path when the target directory name starts with the base path
Closes #2608
The brain for nose was dropped. nose has been deprecated for 10 years and the brain required some maintenance.
Refs #2765
Fix a crash when the root of a node is not a module but is unknown.
Closes #2672
Following a deprecation period, the future argument was removed from statement() and frame().
Removed internal functions infer_numpy_member, name_looks_like_numpy_member, and
attribute_looks_like_numpy_member from astroid.brain.brain_numpy_utils.
To alleviate circular imports, the manager argument to AstroidBuilder() is now required.
Constants now have a parent of nodes.SYNTHETIC_ROOT.
Fix crashes with large positive and negative list multipliers.
Closes #2521 Closes #2523
Fix precedence of path arg in modpath_from_file_with_callback to be higher than sys.path
Following a deprecation period, the future argument was removed from statement() and frame().
Improve consistency of JoinedStr inference by not raising InferenceError and
returning either Uninferable or a fully resolved Const.
Closes #2621
Fix crash when typing._alias() call is missing arguments.
Closes #2513
Fix a crash when parsing an empty arbitrary expression with extract_node (extract_node("__()")).
Fix a crash when parsing an empty arbitrary expression with extract_node (extract_node("__()")).
Closes #2734
Fix a crash when parsing a slice called in a decorator on a function that is also decorated with
a known six decorator.
Closes #2721
Release date: 2025-07-13
Fix a crash when parsing an empty arbitrary expression with extract_node (extract_node("__()")).
Closes #2734
Fix a crash when parsing a slice called in a decorator on a function that is also decorated with
a known six decorator.
Closes #2721
Avoid importing submodules sharing names with standard library modules.
Avoid importing submodules sharing names with standard library modules.
Closes #2684
Fix bug where pylint code.custom_extension would analyze code.py or code.pyi instead if they existed.
Closes pylint-dev/pylint#3631
Release date: 2025-05-10
Avoid importing submodules sharing names with standard library modules.
Closes #2684
Fix bug where pylint code.custom_extension would analyze code.py or code.pyi instead if they existed.
Closes pylint-dev/pylint#3631
Fix crash when sys.modules contains lazy loader objects during checking.
Release date: 2025-03-09
Fix crash when sys.modules contains lazy loader objects during checking.
Closes #2686 Closes pylint-dev/pylint#8589
Upload release assets to PyPI via Trusted Publishing.
Refs pylint-dev/pylint#10256
Fix inability to import collections.abc in python 3.13.1. The reported fixes in astroid 3.3.6 and 3.3.7 did not actually fix this issue.
Release date: 2024-12-23
Fix inability to import collections.abc in python 3.13.1. The reported fixes in astroid 3.3.6
and 3.3.7 did not actually fix this issue.
Closes pylint-dev/pylint#10112
Fix inability to import collections.abc in python 3.13.1. The reported fix in astroid 3.3.6 did not actually fix this issue.
Release date: 2024-12-21
Fix inability to import collections.abc in python 3.13.1. The reported fix in astroid 3.3.6
did not actually fix this issue.
Closes pylint-dev/pylint#10112
Release date: 2024-12-20
This release was yanked.
Fix inability to import collections.abc in python 3.13.1. The reported fix in astroid 3.3.6
did not actually fix this issue.
Closes pylint-dev/pylint#10112
Fix inability to import collections.abc in python 3.13.1. Closes pylint-dev/pylint#10112
Release date: 2024-12-08
Fix inability to import collections.abc in python 3.13.1.
Closes pylint-dev/pylint#10112
Fix crash when typing._alias() call is missing arguments. Closes #2513
Release date: 2024-12-08
Fix inability to import collections.abc in python 3.13.1.
It was later found that this did not resolve the linked issue. It was fixed in astroid 3.3.7
Closes pylint-dev/pylint#10112
Fix crash when typing._alias() call is missing arguments.
Closes #2513
Control setting local nodes outside of the supposed local's constructor.
Release date: 2024-10-04
Control setting local nodes outside of the supposed local's constructor.
Closes #1490
Fix Python 3.13 compatibility re: collections.abc
Closes pylint-dev/pylint#10000
Fix regression with f-string inference.
Release date: 2024-09-23
Fix regression with f-string inference.
Closes pylint-dev/pylint#9947
Fix bug with manager.clear_cache() not fully clearing cache
Refs https://github.com/pylint-dev/pylint/pull/9932#issuecomment-2364985551
Fix a crash from inferring empty format specs.
Closes pylint-dev/pylint#9945
Fix inference regression with property setters.
Release date: 2024-09-20
Fix inference regression with property setters.
Closes pylint-dev/pylint#9811
Add annotation-only instance attributes to attrs classes to fix no-member false positives.
Closes #2514
Restore support for soft-deprecated members of the typing module with python 3.13.
Release date: 2024-08-11
Restore support for soft-deprecated members of the typing module with python 3.13.
Refs pylint-dev/pylint#9852
Fix a crash introduced in 3.3.0 involving invalid format strings.
Release date: 2024-08-06
Fix a crash introduced in 3.3.0 involving invalid format strings.
Closes #2492
Remove support for Python 3.8 (and constants PY38, PY39_PLUS, and PYPY_7_3_11_PLUS).
Release date: 2024-08-04
Add support for Python 3.13.
Remove support for Python 3.8 (and constants PY38, PY39_PLUS, and PYPY_7_3_11_PLUS).
Refs #2443
Add the __annotations__ attribute to the ClassDef object model.
Closes pylint-dev/pylint#7126
Implement inference for JoinedStr and FormattedValue
Add support for ssl.OP_LEGACY_SERVER_CONNECT (new in Python 3.12).
Closes pylint-dev/pylint#9849
Avoid reporting unary/binary op type errors when inference is ambiguous.
Release date: 2024-07-20
Avoid reporting unary/binary op type errors when inference is ambiguous.
Closes #2467
Fix AssertionError when inferring a property consisting of a partial function.
Release date: 2024-07-11
AssertionError when inferring a property consisting of a partial function.Closes pylint-dev/pylint#9214
Improve inference for generic classes using the PEP 695 syntax (Python 3.12).
Release date: 2024-05-20
Improve inference for generic classes using the PEP 695 syntax (Python 3.12).
Refs pylint-dev/pylint#9406
Release date: 2024-05-20
Improve inference for generic classes using the PEP 695 syntax (Python 3.12).
Closes pylint-dev/pylint#9406
Fix RecursionError in infer_call_result() for certain __call__ methods.
Release date: 2024-05-16
Fix RecursionError in infer_call_result() for certain __call__ methods.
Closes pylint-dev/pylint#9139
Add AstroidManager.prefer_stubs attribute to control the astroid 3.2.0 feature that prefers stubs.
Refs pylint-dev/pylint#9626 Refs pylint-dev/pylint#9623
.pyi stub files are now preferred over .py files when resolving imports, (except for numpy).
.pyi stub files are now preferred over .py files when resolving imports, (except for numpy).
Closes pylint-dev/pylint#9185
igetattr() returns the last same-named function in a class (instead of
the first). This avoids false positives in pylint with @overload.
Closes #1015 Refs pylint-dev/pylint#4696
Adds module_denylist to AstroidManager for modules to be skipped during AST
generation. Modules in this list will cause an AstroidImportError to be raised
when an AST for them is requested.
Refs pylint-dev/pylint#9442
Make astroid.interpreter._import.util.is_namespace only consider modules
using a loader set to NamespaceLoader or None as namespaces.
This fixes a problem that six.moves brain was not effective if six.moves
was already imported.
Closes #1107
Following a deprecation period, the names arg to the Import constructor and the op arg to the BoolOp constructor are now required, and the doc args to…
get_children(),
allowing checkers to visit them.
Refs pylint-dev/pylint#9193__main__ as a possible inferred value for __name__ to improve
control flow inference around if __name__ == "__main__": guards.
Closes #2071names arg to the Import constructor and
the op arg to the BoolOp constructor are now required, and the doc args
to the PartialFunction and Property constructors have been removed (call
postinit(doc_node=...) instead.)AstroidBuildingException is removed in favor of AstroidBuildingError.invalid escape sequence warnings
with Python 3.12.RecursionError is now trapped and logged out as UserWarning during astroid node transformations with instructions about raising the system recursion limit.
Closes pylint-dev/pylint#8842SyntaxWarning for invalid escape sequences on Python 3.12 when parsing modules.
Closes pylint-dev/pylint#9322Fix type of UnicodeDecodeError.object inferred as str instead of bytes.
Fix type of UnicodeDecodeError.object inferred as str instead of bytes.
Closes pylint-dev/pylint#9342
Fix no-member false positives for args and kwargs on ParamSpec under Python 3.12.
Closes pylint-dev/pylint#9401
Release date: 2024-02-04
Fix type of UnicodeDecodeError.object inferred as str instead of bytes.
Closes pylint-dev/pylint#9342
Fix no-member false positives for args and kwargs on ParamSpec under Python 3.12.
Closes pylint-dev/pylint#9401
This was causing pylint to occasionally omit messages like deprecated-typing-alias. Closes pylint-dev/pylint#9220
Release date: 2023-12-12
typing.X constructs like
Tuple[Optional[int], ...]. This was causing pylint to occasionally omit
messages like deprecated-typing-alias.
Closes pylint-dev/pylint#9220Fix crashes linting code using PEP 695 (Python 3.12) generic type syntax.
Fix crashes linting code using PEP 695 (Python 3.12) generic type syntax.
Closes pylint-dev/pylint#9098
Release date: 2023-10-15
Fix crashes linting code using PEP 695 (Python 3.12) generic type syntax.
Closes pylint-dev/pylint#9098
nodes.FunctionDef no longer inherits from nodes.Lambda. This is a breaking change but considered a bug fix as the nodes did not share the same API and…
Add support for Python 3.12, including PEP 695 type parameter syntax.
Closes #2201
Remove support for Python 3.7.
Refs #2137
Use the global inference cache when inferring, even without an explicit
InferenceContext. This is a significant performance improvement given how
often methods default to None for the context argument. (Linting astroid
itself now takes ~5% less time on Python 3.12; other projects requiring more
complex inference calculations will see greater speedups.)
Refs #529
Following a deprecation period starting in astroid 2.7.0, the astroid.node_classes
and astroid.scoped_nodes modules have been removed in favor of astroid.nodes.node_classes
and astroid.nodes.scoped_nodes.
Closes #1072
Following a deprecation period starting in astroid 2.12.0, the astroid.mixins module
has been removed in favor of astroid.nodes._base_nodes (private).
Refs #1633
Return all existing arguments when calling Arguments.arguments(). This also means find_argname will now
use the whole list of arguments for its search.
Closes #2213
Exclude class attributes from the __members__ container of an Enum class when they are
nodes.AnnAssign nodes with no assigned value.
Refs pylint-dev/pylint#7402
Remove @cached and @cachedproperty decorator (just use @cached_property from the stdlib).
Closes #1780 Refs #2140
Remove the inference module. Node inference methods are now in the module
defining the node, rather than being associated to the node afterward.
Closes #679
Move LookupMixIn to astroid.nodes._base_nodes and make it private.
Remove the shims for OperationError, BinaryOperationError, and UnaryOperationError
in exceptions. They were moved to util in astroid 1.5.0.
Move safe_infer() from helpers to util. This avoids some circular imports.
Reduce file system access in ast_from_file().
Reduce time to import astroid by delaying astroid_bootstrapping() until
the first instantiation of AstroidBuilder.
Closes #2161
Make igetattr() idempotent. This addresses some reports of varying results
when running pylint with --jobs.
Closes pylint-dev/pylint#4356 Refs #7
Fix incorrect cache keys for inference results, thereby correctly inferring types for calls instantiating types dynamically.
Closes #1828 Closes pylint-dev/pylint#7464 Closes pylint-dev/pylint#8074
Fix interrupted InferenceContext call chains, thereby addressing performance
problems when linting sqlalchemy.
Closes pylint-dev/pylint#8150
nodes.FunctionDef no longer inherits from nodes.Lambda.
This is a breaking change but considered a bug fix as the nodes did not share the same
API and were not interchangeable.
We have tried to minimize the amount of breaking changes caused by this change but some are unavoidable.
infer_call_result now shares the same interface across all implementations. Namely:
def infer_call_result(
self,
caller: SuccessfulInferenceResult | None,
context: InferenceContext | None = None,
) -> Iterator[InferenceResult]:
This is a breaking change for nodes.FunctionDef where previously caller had a default of
None. Passing None again will not create a behaviour change.
The breaking change allows us to better type and re-use the method within astroid.
Improved signature of the __init__ and __postinit__ methods of most nodes.
This includes making lineno, col_offset, end_lineno, end_col_offset and parent
required arguments for nodes.NodeNG and its subclasses.
For most other nodes, arguments of their __postinit__ methods have been made required to better
represent how they would normally be constructed by the standard library ast module.
The following nodes were changed or updated:
nodes.AnnAssignnodes.Argumentsnodes.Assignnodes.AssignAttrnodes.AssignNamenodes.Attributenodes.AugAssignnodes.Awaitnodes.BaseContainernodes.BinOpnodes.Callnodes.ClassDefnodes.Comparenodes.Comprehensionnodes.Decoratorsnodes.Deletenodes.DelAttrnodes.DelNamenodes.Dictnodes.DictCompnodes.ExceptHandlernodes.Exprnodes.Fornodes.FunctionDefnodes.GeneratorExpnodes.Ifnodes.IfExpnodes.Keywordnodes.Lambdanodes.ListCompnodes.Modulenodes.Namenodes.NodeNGnodes.Raisenodes.Returnnodes.SetCompnodes.Slicenodes.Starredobjects.Super, we also added the call parameter to its __init__ method.nodes.Subscriptnodes.UnaryOpnodes.Whilenodes.YieldThese changes involve breaking changes to their API but should be considered bug fixes. We now make arguments required when they are instead of always providing defaults.
nodes.If.self.is_orelse has been removed as it was never set correctly and therefore
provided a false value.
Remove dependency on wrapt.
Remove dependency on lazy_object_proxy. This includes the removal
of the associated lazy_import, lazy_descriptor and proxy_alias utility functions.
CallSite._unpack_args and CallSite._unpack_keywords now use safe_infer() for
better inference and fewer false positives.
Closes pylint-dev/pylint#8544
Add attr.Factory to the recognized class attributes for classes decorated with attrs.
Closes pylint-dev/pylint#4341
infer_property() now observes the same property-specific workaround as infer_functiondef.
Refs #1490
Remove unused and / or deprecated constants:
astroid.bases.BOOL_SPECIAL_METHODastroid.bases.BUILTINSastroid.const.BUILTINSastroid.const.PY38_PLUSastroid.const.Loadastroid.const.Storeastroid.const.DelRefs #2141
frame() raises ParentMissingError and statement() raises StatementMissing for
missing parents regardless of the value of the future argument (which gave this behavior
already).
The future argument to each method is deprecated and will be removed in astroid 4.0.
Refs #1217
Remove deprecated Ellipsis, ExtSlice, Index nodes.
Refs #2152
Remove deprecated is_sys_guard and is_typing_guard methods.
Refs #2153
Remove deprecated doc attribute for Module, ClassDef, and FunctionDef.
Use the doc_node attribute instead.
Refs #2154
Add new nodes.Try to better match Python AST. Replaces the TryExcept
and TryFinally nodes which have been removed.
Publicize NodeNG.repr_name() to facilitate finding a node's nice name.
Refs pylint-dev/pylint#8598
Fix false positives for no-member and invalid-name when using the _name_, _value_ and _ignore_ sunders in Enums.
Closes pylint-dev/pylint#9015
Pre-release for astroid 3.0.0, with API deprecation applied.
Pre-release for astroid 3.0.0, with API deprecation applied.
Pre-release for astroid 3.0.0, with performance improvements, fixes for Python 3.12 compatibility, and an improvement to Arguments.arguments(), among
Pre-release for astroid 3.0.0, with performance improvements, fixes for Python 3.12 compatibility, and an improvement to Arguments.arguments(), among other changes.
See the full list of changes.
Pre-release for astroid 3.0.0, for https://github.com/pylint-dev/astroid/pull/2250 and python 3.12 in pylint. For a full list of changes see https://g
Pre-release for astroid 3.0.0, for https://github.com/pylint-dev/astroid/pull/2250 and python 3.12 in pylint. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a8/ChangeLog
This is the seventh pre-release for astroid 3.0.0, main change is added Try node. For a full list of changes see https://github.com/pylint-dev/astroid
This is the seventh pre-release for astroid 3.0.0, main change is added Try node. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a7/ChangeLog
This is the sixth pre-release for astroid 3.0.0, main change is the python 3.12 support. For a full list of changes see https://github.com/pylint-dev/
This is the sixth pre-release for astroid 3.0.0, main change is the python 3.12 support. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a6/ChangeLog
This is the fifth pre-release for astroid 3.0.0. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a5/ChangeLog
This is the fifth pre-release for astroid 3.0.0. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a5/ChangeLog
This is the fourth pre-release for astroid 3.0.0. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a4/ChangeLog
This is the fourth pre-release for astroid 3.0.0. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a4/ChangeLog
This is the third pre-release for astroid 3.0.0. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a3/ChangeLog
This is the third pre-release for astroid 3.0.0. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a3/ChangeLog
This is the second pre-release for astroid 3.0.0. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a1/ChangeLog
This is the second pre-release for astroid 3.0.0. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a1/ChangeLog
This is the first pre-release for astroid 3.0.0. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a1/ChangeLog
This is the first pre-release for astroid 3.0.0. For a full list of changes see https://github.com/pylint-dev/astroid/blob/v3.0.0a1/ChangeLog
Fix a regression in 2.15.7 for unsubscriptable-object.
Fix a regression in 2.15.7 for unsubscriptable-object.
Closes #2305 Closes pylint-dev/pylint#9069
Release date: 2023-09-26
Fix a regression in 2.15.7 for unsubscriptable-object.
Closes #2305 Closes pylint-dev/pylint#9069
Fix a crash when inferring a typing.TypeVar call.
Fix a crash when inferring a typing.TypeVar call.
Closes pylint-dev/pylint#8802
Infer user-defined enum classes by checking if the class is a subtype of enum.Enum.
Closes pylint-dev/pylint#8897
Fix inference of functions with @functools.lru_cache decorators without
parentheses.
Closes pylint-dev/pylint#8868
Make sys.argv uninferable because it never is. (It's impossible to infer
the value it will have outside of static analysis where it's our own value.)
Refs pylint-dev/pylint#7710
Release date: TBA
Fix a crash when inferring a typing.TypeVar call.
Closes pylint-dev/pylint#8802
Fix inference of functions with @functools.lru_cache decorators without
parentheses.
Closes pylint-dev/pylint#8868
Harden get_module_part() against ".".
Harden get_module_part() against ".".
Closes pylint-dev/pylint#8749
Avoid expensive list/tuple multiplication operations that would result in MemoryError.
Closes pylint-dev/pylint#8748
Release date: 2023-07-08
Harden get_module_part() against ".".
Closes pylint-dev/pylint#8749
Allow AsStringVisitor to visit objects.PartialFunction.
Closes pylint-dev/pylint#8881
Avoid expensive list/tuple multiplication operations that would result in MemoryError.
Closes pylint-dev/pylint#8748
Fix a regression in 2.12.0 where settings in AstroidManager would be ignored. Most notably this addresses pylint-dev/pylint#7433.
Refs #2204
Handle objects.Super in helpers.object_type().
Handle objects.Super in helpers.object_type().
Refs pylint-dev/pylint#8554
Release date: 2023-05-14
Handle objects.Super in helpers.object_type().
Refs pylint-dev/pylint#8554
Recognize stub pyi Python files.
Refs pylint-dev/pylint#4987
Add visitor function for TryStar to AsStringVisitor and add TryStar to astroid.nodes.ALL_NODE_CLASSES.
Add visitor function for TryStar to AsStringVisitor and
add TryStar to astroid.nodes.ALL_NODE_CLASSES.
Refs #2142
Release date: 2023-04-24
Add visitor function for TryStar to AsStringVisitor and
add TryStar to astroid.nodes.ALL_NODE_CLASSES.
Refs #2142
Your coding agent can read these notes before it upgrades. Set up the MCP server →