@@ -1452,20 +1452,21 @@ def test_blob_set_slice_with_negative_step(self):
14521452 self .blob [3 :8 :- 1 ] = b""
14531453 self .assertEqual (bytes (self .blob [:]), state_before )
14541454
1455- # Extreme step values: cur += (size_t)step must not overflow.
1456- # Use the current blob state (already modified above) as baseline.
1457- current = bytes (self .blob [:])
1458- expected3 = bytearray (current )
1459- expected3 [5 ::sys .maxsize ] = current [5 ::sys .maxsize ]
1460- self .blob [5 ::sys .maxsize ] = current [5 ::sys .maxsize ]
1461- actual3 = self .cx .execute ("select b from test" ).fetchone ()[0 ]
1462- self .assertEqual (actual3 , bytes (expected3 ))
1463-
1464- expected4 = bytearray (actual3 )
1465- expected4 [::- sys .maxsize - 1 ] = bytes (actual3 )[::- sys .maxsize - 1 ]
1466- self .blob [::- sys .maxsize - 1 ] = bytes (actual3 )[::- sys .maxsize - 1 ]
1467- actual4 = self .cx .execute ("select b from test" ).fetchone ()[0 ]
1468- self .assertEqual (actual4 , bytes (expected4 ))
1455+ def test_blob_set_slice_with_extreme_positive_step (self ):
1456+ expected = bytearray (self .data )
1457+ expected [5 ::sys .maxsize ] = b"\xab "
1458+ self .blob [5 ::sys .maxsize ] = b"\xab "
1459+ actual = self .cx .execute ("select b from test" ).fetchone ()[0 ]
1460+ self .assertEqual (actual , bytes (expected ))
1461+ self .assertEqual (actual [5 ], 0xab )
1462+
1463+ def test_blob_set_slice_with_extreme_negative_step (self ):
1464+ expected = bytearray (self .data )
1465+ expected [::- sys .maxsize - 1 ] = b"\xcd "
1466+ self .blob [::- sys .maxsize - 1 ] = b"\xcd "
1467+ actual = self .cx .execute ("select b from test" ).fetchone ()[0 ]
1468+ self .assertEqual (actual , bytes (expected ))
1469+ self .assertEqual (actual [- 1 ], 0xcd )
14691470
14701471 def test_blob_mapping_invalid_index_type (self ):
14711472 msg = "indices must be integers"
0 commit comments