@@ -12,17 +12,150 @@ Release date: TBA
1212
1313 Closes #2974
1414
15+ * Shorten ``import astroid`` by deferring imports only needed on cold paths.
16+ ``logging`` (used by ``modutils`` and ``raw_building`` solely to report
17+ stderr/stdout captured while importing a module) and ``pprint`` (used only
18+ to format debug ``__repr__`` / ``repr_tree`` output) are now imported
19+ lazily, and ``astroid.exceptions`` imports ``astroid.typing`` under
20+ ``TYPE_CHECKING``.
21+
22+ * Fix ``AttributeError`` crash in ``starred_assigned_stmts`` when a starred
23+ unpacking target is an attribute (e.g. ``for *o.attr, x in ...``) rather
24+ than a simple name.
25+
26+ Closes #2646
27+
28+ * Wrap assignment expressions (``:=``) in parentheses when emitting
29+ ``as_string`` output so the rendered code remains syntactically valid in
30+ contexts such as comparisons, where Python requires the walrus expression
31+ to be parenthesized.
32+
33+ Closes #2668
34+
35+ * Catch ``MemoryError``/``RecursionError`` (and ``ValueError``) when validating
36+ type comments with ``ast.parse``. Pathological type comments produced by
37+ fuzzers (e.g. ``# type: i{{{{{{{...``) previously crashed parsing with a
38+ ``MemoryError`` or ``RecursionError`` depending on the runtime; astroid now
39+ treats them as invalid type comments and skips them, mirroring the f-string
40+ fix from #2762.
41+
42+ Closes #2993
43+
44+ * Fix ``TypeError`` in ``brain_random`` when ``random.sample`` is called with a
45+ sequence containing nodes whose ``__init__`` does not accept ``lineno``
46+ (e.g. ``Module``). The clone helper now filters init params to those the
47+ class actually accepts.
48+
49+ Closes #3043
50+
51+ * Fix ``RecursionError`` in ``_compute_mro()`` when circular class hierarchies
52+ are created through runtime name rebinding. Circular bases are now resolved
53+ to the original class instead of recursing.
54+
55+ Closes #3023
56+ Closes pylint-dev/pylint#10821
57+
58+ * Changed `block_range` to consider `else` its own block, allowing `pylint` to apply
59+ disables to just the block.
60+
61+ References pylint-dev/pylint#872
62+
63+ * Fix uncaught ``TokenError`` when building a class or function whose source
64+ slice is malformed. ``tokenize.generate_tokens`` may raise (e.g. on an
65+ unterminated bracket on Python < 3.12); position computation now treats such
66+ a node as having no position information instead of crashing.
67+
68+ Closes #2527
69+
70+ * ``str()`` of a constant argument now infers the actual string value instead
71+ of always inferring ``""``. When every inference path of the argument
72+ resolves to ``Const`` values that stringify to the same string, ``infer_str``
73+ returns that string; otherwise it keeps falling back to ``Const("")``.
74+
75+ Closes #2994
76+
77+ * Fix ``AttributeError`` crash when looking up a special method on a class
78+ whose explicit metaclass infers to a non-class node (e.g. a function). Such
79+ a metaclass has no MRO, so the dunder lookup now raises
80+ ``AttributeInferenceError`` instead of crashing.
81+
82+ Closes #3063
83+
84+ * Fix ``AttributeError`` crash in ``ClassDef.getitem`` when ``__class_getitem__``
85+ resolves to a non-callable node (e.g. an ``AssignName``). ``getitem`` now
86+ raises ``AstroidTypeError`` in that case, consistent with its documented
87+ behaviour.
88+
89+ Closes #3064
90+
91+ * Fix ``DuplicateBasesError`` crash in the enum brain when inferring an enum
92+ class with duplicate bases (e.g. ``class C(enum.Enum, enum.Enum)``).
93+ ``infer_enum_class`` now catches ``MroError`` and leaves such a malformed
94+ class untransformed.
95+
96+ Closes #3065
97+
98+ * Fix ``InferenceError`` crash in ``ClassDef.slots()`` when ``__slots__`` is
99+ declared as an annotation without a value (e.g. ``__slots__: None``). Such a
100+ ``__slots__`` cannot be inferred, so ``slots()`` now returns ``None``.
101+
102+ Closes #3067
103+
104+
105+ What's New in astroid 4.1.2?
106+ Release date: 2026-03-22
107+
108+ * Fix crash accessing property `fset` in generic classes with type annotations.
109+ Closes #2996
110+
111+ * Fix infinite recursion caused by cyclic inference in ``Constraint``.
112+
113+ * Fix ``RecursionError`` in ``_compute_mro()`` when circular class hierarchies
114+ are created through runtime name rebinding. Circular bases are now resolved
115+ to the original class instead of recursing.
116+
117+ Closes #2967
118+ Closes pylint-dev/pylint#10821
119+
120+ * Fix ``DuplicateBasesError`` crash in dataclass transform when a class has
121+ duplicate bases in its MRO (e.g., ``Protocol`` appearing both directly and
122+ indirectly). Catch ``MroError`` at ``.mro()`` call sites in
123+ ``brain_dataclasses.py``, consistent with the existing pattern elsewhere.
124+
125+ Closes #2628
126+
127+ * Fix ``FunctionModel`` returning descriptor attributes for builtin functions.
128+
129+ Closes #2743
130+
131+ * Catch ``MemoryError`` when inferring f-strings with extremely large format
132+ widths (e.g. ``f'{0:11111111111}'``) so that inference yields ``Uninferable``
133+ instead of crashing.
134+
135+ Closes #2762
136+
137+ * Fix ``ValueError`` in ``__str__``/``repr`` and error messages when nodes have
138+ extreme values (very long identifiers or large integers). Clamp pprint width
139+ to a minimum of 1 and truncate oversized values in error messages.
140+
141+ Closes #2764
142+
15143
16144What's New in astroid 4.1.1?
17145============================
18- Release date: TBA
146+ Release date: 2026-02-22
19147
20148* Let `UnboundMethodModel` inherit from `FunctionModel` to improve inference of
21149 dunder methods for unbound methods.
22150
151+ Refs #2741
152+
23153* Filter ``Unknown`` from ``UnboundMethod`` and ``Super`` special attribute
24154 lookup to prevent placeholder nodes from leaking during inference.
25155
156+ Refs #2741
157+
158+
26159What's New in astroid 4.1.0?
27160============================
28161Release date: 2026-02-08
0 commit comments