summaryrefslogtreecommitdiff
path: root/sphinx/pycode/ast.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-06-15 10:15:53 +0100
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-06-15 10:15:53 +0100
commitb8a38f037be69229fdb8caf811f0cb04759e43e3 (patch)
treeeed0447c612f677a575f1224c3e3107771106be7 /sphinx/pycode/ast.py
parent05b835114baf1886ae140fb430f3622c58d2ab46 (diff)
downloadsphinx-git-b8a38f037be69229fdb8caf811f0cb04759e43e3.tar.gz
Special case `**`
Diffstat (limited to 'sphinx/pycode/ast.py')
-rw-r--r--sphinx/pycode/ast.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/sphinx/pycode/ast.py b/sphinx/pycode/ast.py
index b2a00db80..51af563c4 100644
--- a/sphinx/pycode/ast.py
+++ b/sphinx/pycode/ast.py
@@ -141,6 +141,9 @@ class _UnparseVisitor(ast.NodeVisitor):
return "%s.%s" % (self.visit(node.value), node.attr)
def visit_BinOp(self, node: ast.BinOp) -> str:
+ # Special case ``**`` to now have surrounding spaces.
+ if isinstance(node.op, ast.Pow):
+ return "".join(map(self.visit, (node.left, node.op, node.right)))
return " ".join(self.visit(e) for e in [node.left, node.op, node.right])
def visit_BoolOp(self, node: ast.BoolOp) -> str: