Skip to content

Commit 3702159

Browse files
author
Anton Larionov
committed
Fix argument redefinition in function
1 parent ccbe41e commit 3702159

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Lib/ast.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,14 @@ def get_docstring(node, clean=True):
316316
"""
317317
if not isinstance(node, (AsyncFunctionDef, FunctionDef, ClassDef, Module)):
318318
raise TypeError("%r can't have docstrings" % node.__class__.__name__)
319-
if not(node.body and isinstance(node.body[0], Expr)):
319+
if not (node.body and isinstance(node.body[0], Expr)):
320320
return None
321-
node = node.body[0].value
322-
if isinstance(node, Constant) and isinstance(node.value, str):
323-
text = node.value
321+
checking_node = node.body[0].value
322+
if (
323+
isinstance(checking_node, Constant)
324+
and isinstance(checking_node.value, str)
325+
):
326+
text = checking_node.value
324327
else:
325328
return None
326329
if clean:

0 commit comments

Comments
 (0)