File tree 3 files changed +14
-1
lines changed
3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,10 @@ Release date: TBA
57
57
58
58
Closes pylint-dev/pylint#8544
59
59
60
+ * ``infer_property()`` now observes the same property-specific workaround as ``infer_functiondef``.
61
+
62
+ Refs #1490
63
+
60
64
What's New in astroid 2.15.3?
61
65
=============================
62
66
Release date: TBA
Original file line number Diff line number Diff line change @@ -562,9 +562,10 @@ def infer_property(
562
562
function = inferred ,
563
563
name = inferred .name ,
564
564
lineno = node .lineno ,
565
- parent = node ,
566
565
col_offset = node .col_offset ,
567
566
)
567
+ # Set parent outside __init__: https://github.com/pylint-dev/astroid/issues/1490
568
+ prop_func .parent = node
568
569
prop_func .postinit (
569
570
body = [],
570
571
args = inferred .args ,
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ def getter():
24
24
)
25
25
inferred_property = list (class_with_property .value .infer ())[0 ]
26
26
self .assertTrue (isinstance (inferred_property , objects .Property ))
27
+ class_parent = inferred_property .parent .parent .parent
28
+ self .assertIsInstance (class_parent , nodes .ClassDef )
29
+ self .assertFalse (
30
+ any (
31
+ isinstance (getter , objects .Property )
32
+ for getter in class_parent .locals ["getter" ]
33
+ )
34
+ )
27
35
self .assertTrue (hasattr (inferred_property , "args" ))
28
36
29
37
You can’t perform that action at this time.
0 commit comments