[Python-3000-checkins] r51531 - in python/branches/p3yk: Lib/test/test_bytes.py Objects/bytesobject.c
thomas.wouters
python-3000-checkins at python.org
Thu Aug 24 01:20:30 CEST 2006
Author: thomas.wouters
Date: Thu Aug 24 01:20:29 2006
New Revision: 51531
Modified:
python/branches/p3yk/Lib/test/test_bytes.py
python/branches/p3yk/Objects/bytesobject.c
Log:
Fix buglet in slice assignment of bytesobjects: assigning to b[3:0] ('stop'
being before 'start') would actually assign to b[0:0] (or whatever 'stop'
was)
Modified: python/branches/p3yk/Lib/test/test_bytes.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_bytes.py (original)
+++ python/branches/p3yk/Lib/test/test_bytes.py Thu Aug 24 01:20:29 2006
@@ -235,6 +235,9 @@
b[3:5] = [3, 4, 5, 6]
self.assertEqual(b, bytes(range(10)))
+
+ b[3:0] = [42, 42, 42]
+ self.assertEqual(b, bytes([0, 1, 2, 42, 42, 42, 3, 4, 5, 6, 7, 8, 9]))
def test_setslice_trap(self):
# This test verifies that we correctly handle assigning self
Modified: python/branches/p3yk/Objects/bytesobject.c
==============================================================================
--- python/branches/p3yk/Objects/bytesobject.c (original)
+++ python/branches/p3yk/Objects/bytesobject.c Thu Aug 24 01:20:29 2006
@@ -310,6 +310,8 @@
if (lo < 0)
lo = 0;
+ if (hi < lo)
+ hi = lo;
if (hi > self->ob_size)
hi = self->ob_size;
More information about the Python-3000-checkins
mailing list