@@ -129,8 +129,8 @@ def dump(
129129 include_attributes can be set to true. If indent is a non-negative
130130 integer or string, then the tree will be pretty-printed with that indent
131131 level. None (the default) selects the single line representation.
132- If show_empty is False, then empty lists, fields that are None,
133- and empty strings will be ommitted from the output for better readability.
132+ If show_empty is False, then empty lists and fields that are None
133+ will be ommitted from the output for better readability.
134134 """
135135 def _format (node , level = 0 ):
136136 if indent is not None :
@@ -156,7 +156,7 @@ def _format(node, level=0):
156156 continue
157157 if (
158158 not show_empty
159- and value in empty_values
159+ and ( value is None or value == [])
160160 and not isinstance (node , Constant )
161161 ):
162162 # Special case: `Constant(value=None)`
@@ -191,7 +191,6 @@ def _format(node, level=0):
191191 raise TypeError ('expected AST, got %r' % node .__class__ .__name__ )
192192 if indent is not None and not isinstance (indent , str ):
193193 indent = ' ' * indent
194- empty_values = (None , [])
195194 return _format (node )[0 ]
196195
197196
0 commit comments