@@ -84,8 +84,8 @@ def deprecated_err(func, *args):
8484if sz * 3 != struct .calcsize ('iii' ):
8585 raise TestFailed , 'inconsistent sizes'
8686
87- fmt = 'cbxxxxxxhhhhiillffdt '
88- fmt3 = '3c3b18x12h6i6l6f3d3t '
87+ fmt = 'cbxxxxxxhhhhiillffd? '
88+ fmt3 = '3c3b18x12h6i6l6f3d3? '
8989sz = struct .calcsize (fmt )
9090sz3 = struct .calcsize (fmt3 )
9191if sz * 3 != sz3 :
@@ -111,7 +111,7 @@ def deprecated_err(func, *args):
111111t = True
112112
113113for prefix in ('' , '@' , '<' , '>' , '=' , '!' ):
114- for format in ('xcbhilfdt ' , 'xcBHILfdt ' ):
114+ for format in ('xcbhilfd? ' , 'xcBHILfd? ' ):
115115 format = prefix + format
116116 if verbose :
117117 print "trying:" , format
@@ -160,11 +160,11 @@ def deprecated_err(func, *args):
160160 ('f' , - 2.0 , '\300 \000 \000 \000 ' , '\000 \000 \000 \300 ' , 0 ),
161161 ('d' , - 2.0 , '\300 \000 \000 \000 \000 \000 \000 \000 ' ,
162162 '\000 \000 \000 \000 \000 \000 \000 \300 ' , 0 ),
163- ('t ' , 0 , '\0 ' , '\0 ' , 0 ),
164- ('t ' , 3 , '\1 ' , '\1 ' , 1 ),
165- ('t ' , True , '\1 ' , '\1 ' , 0 ),
166- ('t ' , [], '\0 ' , '\0 ' , 1 ),
167- ('t ' , (1 ,), '\1 ' , '\1 ' , 1 ),
163+ ('? ' , 0 , '\0 ' , '\0 ' , 0 ),
164+ ('? ' , 3 , '\1 ' , '\1 ' , 1 ),
165+ ('? ' , True , '\1 ' , '\1 ' , 0 ),
166+ ('? ' , [], '\0 ' , '\0 ' , 1 ),
167+ ('? ' , (1 ,), '\1 ' , '\1 ' , 1 ),
168168]
169169
170170for fmt , arg , big , lil , asy in tests :
@@ -633,13 +633,13 @@ def test_bool():
633633 false = (), [], [], '' , 0
634634 true = [1 ], 'test' , 5 , - 1 , 0xffffffffL + 1 , 0xffffffff / 2
635635
636- falseFormat = prefix + 't ' * len (false )
636+ falseFormat = prefix + '? ' * len (false )
637637 if verbose :
638638 print 'trying bool pack/unpack on' , false , 'using format' , falseFormat
639639 packedFalse = struct .pack (falseFormat , * false )
640640 unpackedFalse = struct .unpack (falseFormat , packedFalse )
641641
642- trueFormat = prefix + 't ' * len (true )
642+ trueFormat = prefix + '? ' * len (true )
643643 if verbose :
644644 print 'trying bool pack/unpack on' , true , 'using format' , trueFormat
645645 packedTrue = struct .pack (trueFormat , * true )
@@ -658,10 +658,10 @@ def test_bool():
658658 raise TestFailed ('%r did not unpack as false' % t )
659659
660660 if prefix and verbose :
661- print 'trying size of bool with format %r' % (prefix + 't ' )
662- packed = struct .pack (prefix + 't ' , 1 )
661+ print 'trying size of bool with format %r' % (prefix + '? ' )
662+ packed = struct .pack (prefix + '? ' , 1 )
663663
664- if len (packed ) != struct .calcsize (prefix + 't ' ):
664+ if len (packed ) != struct .calcsize (prefix + '? ' ):
665665 raise TestFailed ('packed length is not equal to calculated size' )
666666
667667 if len (packed ) != 1 and prefix :
@@ -670,7 +670,7 @@ def test_bool():
670670 print 'size of bool in native format is %i' % (len (packed ))
671671
672672 for c in '\x01 \x7f \xff \x0f \xf0 ' :
673- if struct .unpack ('>t ' , c )[0 ] is not True :
673+ if struct .unpack ('>? ' , c )[0 ] is not True :
674674 raise TestFailed ('%c did not unpack as True' % c )
675675
676676test_bool ()
0 commit comments