summaryrefslogtreecommitdiffstats
path: root/Lib/ast.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/ast.py')
-rw-r--r--Lib/ast.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/ast.py b/Lib/ast.py
index e81e280..4e2ae85 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -1335,7 +1335,11 @@ class _Unparser(NodeVisitor):
)
def visit_Tuple(self, node):
- with self.require_parens(_Precedence.TUPLE, node):
+ with self.delimit_if(
+ "(",
+ ")",
+ len(node.elts) == 0 or self.get_precedence(node) > _Precedence.TUPLE
+ ):
self.items_view(self.traverse, node.elts)
unop = {"Invert": "~", "Not": "not", "UAdd": "+", "USub": "-"}