Skip to content

Commit 28321a3

Browse files
Refs #1490 - Removed constructor workaround in PartialFunction (#2787)
1 parent 9256b31 commit 28321a3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

astroid/objects.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,18 +274,15 @@ class PartialFunction(scoped_nodes.FunctionDef):
274274
"""A class representing partial function obtained via functools.partial."""
275275

276276
def __init__(self, call, name=None, lineno=None, col_offset=None, parent=None):
277-
# TODO: Pass end_lineno, end_col_offset and parent as well
277+
# TODO: Pass end_lineno, end_col_offset as well
278278
super().__init__(
279279
name,
280280
lineno=lineno,
281281
col_offset=col_offset,
282-
parent=scoped_nodes.SYNTHETIC_ROOT,
283282
end_col_offset=0,
284283
end_lineno=0,
284+
parent=parent,
285285
)
286-
# A typical FunctionDef automatically adds its name to the parent scope,
287-
# but a partial should not, so defer setting parent until after init
288-
self.parent = parent
289286
self.filled_args = call.positional_arguments[1:]
290287
self.filled_keywords = call.keyword_arguments
291288

0 commit comments

Comments
 (0)