Skip to content

Commit 549e176

Browse files
committed
Fix builtin inference on property not including function arguments
1 parent e005459 commit 549e176

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ What's New in astroid 2.10.0?
66
=============================
77
Release date: TBA
88

9+
* Fixed builtin inferenence on `property` calls not calling the `postinit` of the new node, which
10+
resulted in instance arguments missing on these nodes.
911

1012
What's New in astroid 2.9.4?
1113
============================

astroid/brain/brain_builtin_inference.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,14 +566,16 @@ def infer_property(node, context=None):
566566
if not isinstance(inferred, (nodes.FunctionDef, nodes.Lambda)):
567567
raise UseInferenceDefault
568568

569-
return objects.Property(
569+
prop_func = objects.Property(
570570
function=inferred,
571571
name=inferred.name,
572572
doc=getattr(inferred, "doc", None),
573573
lineno=node.lineno,
574574
parent=node,
575575
col_offset=node.col_offset,
576576
)
577+
prop_func.postinit(body=[], args=inferred.args)
578+
return prop_func
577579

578580

579581
def infer_bool(node, context=None):

0 commit comments

Comments
 (0)