summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhippo91 <guillaume.peillex@gmail.com>2021-02-06 15:53:49 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-02-10 19:30:13 +0100
commitf50eff2fb9a11d7d4360c27e317ac8fcfa95c145 (patch)
treefc090f69a763173b14f2284e2b66cc7c01c54dd0
parent28221cc28d45c19cf33905396ee5521a77f8a788 (diff)
downloadastroid-git-f50eff2fb9a11d7d4360c27e317ac8fcfa95c145.tar.gz
Setting hard the arguments of method property setter
-rw-r--r--astroid/interpreter/objectmodel.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/astroid/interpreter/objectmodel.py b/astroid/interpreter/objectmodel.py
index 3b0bfe13..eb2de21b 100644
--- a/astroid/interpreter/objectmodel.py
+++ b/astroid/interpreter/objectmodel.py
@@ -797,9 +797,9 @@ class PropertyModel(ObjectModel):
@property
def attr_fset(self):
from astroid.scoped_nodes import FunctionDef
+ from astroid.node_classes import Arguments, AssignName
func = self._instance
-
class PropertyFuncAccessor(FunctionDef):
def infer_call_result(self, caller=None, context=None):
nonlocal func
@@ -813,7 +813,18 @@ class PropertyModel(ObjectModel):
)
property_accessor = PropertyFuncAccessor(name="fset", parent=self._instance)
- property_accessor.postinit(args=func.args, body=func.body)
+ l_args = Arguments()
+ l_args.postinit(
+ args=[AssignName(name="self"), AssignName(name="value")],
+ defaults=[],
+ kwonlyargs=[],
+ kw_defaults=[],
+ annotations=[],
+ posonlyargs=[],
+ posonlyargs_annotations=[],
+ kwonlyargs_annotations=[],
+ )
+ property_accessor.postinit(args=l_args, body=func.body)
return property_accessor
@property