File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -1012,6 +1012,16 @@ def test_constants(self):
10121012 self .assertIs (self .loads (b'I01\n .' ), True )
10131013 self .assertIs (self .loads (b'I00\n .' ), False )
10141014
1015+ def test_issue135241 (self ):
1016+ # C implementation should check for hardcoded values 00 and 01
1017+ # when getting booleans from the INT opcode. Doing a str comparison
1018+ # to bypass truthy/falsy comparisons. These payloads should return
1019+ # 0, not False.
1020+ out1 = self .loads (b'I+0\n .' )
1021+ self .assertTrue (str (out1 ) == str (0 ))
1022+ out2 = self .loads (b'I 0\n .' )
1023+ self .assertTrue (str (out2 ) == str (0 ))
1024+
10151025 def test_zero_padded_integers (self ):
10161026 self .assertEqual (self .loads (b'I010\n .' ), 10 )
10171027 self .assertEqual (self .loads (b'I-010\n .' ), - 10 )
Original file line number Diff line number Diff line change @@ -376,16 +376,6 @@ class CUnpicklerTests(PyUnpicklerTests):
376376 bad_stack_errors = (pickle .UnpicklingError ,)
377377 truncated_errors = (pickle .UnpicklingError ,)
378378
379- def test_issue135241 (self ):
380- # C implementation should check for hardcoded values 00 and 01
381- # when getting booleans from the INT opcode. Doing a str comparison
382- # to bypass truthy/falsy comparisons. These payloads should return
383- # 0, not False.
384- out1 = self .loads (b'I+0\n .' )
385- self .assertTrue (str (out1 ) == str (0 ))
386- out2 = self .loads (b'I 0\n .' )
387- self .assertTrue (str (out2 ) == str (0 ))
388-
389379 class CPicklingErrorTests (PyPicklingErrorTests ):
390380 pickler = _pickle .Pickler
391381
You can’t perform that action at this time.
0 commit comments