File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -228,8 +228,8 @@ def writeValue(self, value):
228228 def writeData (self , data ):
229229 self .beginElement ("data" )
230230 self .indentLevel -= 1
231- maxlinelength = 76 - len (self .indent .replace (b"\t " , b" " * 8 ) *
232- self .indentLevel )
231+ maxlinelength = max ( 16 , 76 - len (self .indent .replace (b"\t " , b" " * 8 ) *
232+ self .indentLevel ))
233233 for line in data .asBase64 (maxlinelength ).split (b"\n " ):
234234 if line :
235235 self .writeln (line )
Original file line number Diff line number Diff line change @@ -141,6 +141,18 @@ def test_bytes(self):
141141 data2 = plistlib .writePlistToBytes (pl2 )
142142 self .assertEqual (data , data2 )
143143
144+ def test_indentation_array (self ):
145+ data = [[[[[[[[{'test' : plistlib .Data (b'aaaaaa' )}]]]]]]]]
146+ self .assertEqual (plistlib .readPlistFromBytes (plistlib .writePlistToBytes (data )), data )
147+
148+ def test_indentation_dict (self ):
149+ data = {'1' : {'2' : {'3' : {'4' : {'5' : {'6' : {'7' : {'8' : {'9' : plistlib .Data (b'aaaaaa' )}}}}}}}}}
150+ self .assertEqual (plistlib .readPlistFromBytes (plistlib .writePlistToBytes (data )), data )
151+
152+ def test_indentation_dict_mix (self ):
153+ data = {'1' : {'2' : [{'3' : [[[[[{'test' : plistlib .Data (b'aaaaaa' )}]]]]]}]}}
154+ self .assertEqual (plistlib .readPlistFromBytes (plistlib .writePlistToBytes (data )), data )
155+
144156 def test_appleformatting (self ):
145157 pl = plistlib .readPlistFromBytes (TESTDATA )
146158 data = plistlib .writePlistToBytes (pl )
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ Core and Builtins
4949Library
5050-------
5151
52+ - Issue #17353: Plistlib emitted empty data tags with deeply nested datastructures
53+
5254- Issue #11714: Use 'with' statements to assure a Semaphore releases a
5355 condition variable. Original patch by Thomas Rachel.
5456
You can’t perform that action at this time.
0 commit comments