Skip to content

Commit 9aa1228

Browse files
DanielNoordcdce8p
andauthored
Deprecate passing doc to PartialFunction (#1456)
Co-authored-by: Marc Mueller <[email protected]>
1 parent 0aa7c39 commit 9aa1228

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

astroid/objects.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import sys
2626
from typing import TYPE_CHECKING
2727

28-
from astroid import bases, util
28+
from astroid import bases, decorators, util
2929
from astroid.exceptions import (
3030
AttributeInferenceError,
3131
InferenceError,
@@ -266,11 +266,14 @@ class DictValues(bases.Proxy):
266266
class PartialFunction(scoped_nodes.FunctionDef):
267267
"""A class representing partial function obtained via functools.partial"""
268268

269+
@decorators.deprecate_arguments(doc="Use the postinit arg 'doc_node' instead")
269270
def __init__(
270271
self, call, name=None, doc=None, lineno=None, col_offset=None, parent=None
271272
):
272273
# TODO: Pass end_lineno and end_col_offset as well
273-
super().__init__(name, doc, lineno, col_offset, parent=None)
274+
super().__init__(name, lineno=lineno, col_offset=col_offset, parent=None)
275+
# Assigned directly to prevent triggering the DeprecationWarning.
276+
self._doc = doc
274277
# A typical FunctionDef automatically adds its name to the parent scope,
275278
# but a partial should not, so defer setting parent until after init
276279
self.parent = parent

0 commit comments

Comments
 (0)