# HG changeset patch # Parent a90ea7e2f7b9cdcc57c57705109cdc72c7051df0 diff -r a90ea7e2f7b9 Lib/multiprocessing/managers.py --- a/Lib/multiprocessing/managers.py Tue Aug 31 21:10:39 2010 +0200 +++ b/Lib/multiprocessing/managers.py Tue Aug 31 21:26:35 2010 +0200 @@ -32,7 +32,7 @@ # def reduce_array(a): - return array.array, (a.typecode, a.tostring()) + return array.array, (a.typecode, a.tobytes()) ForkingPickler.register(array.array, reduce_array) view_types = [type(getattr({}, name)()) for name in ('items','keys','values')] diff -r a90ea7e2f7b9 Lib/sre_compile.py --- a/Lib/sre_compile.py Tue Aug 31 21:10:39 2010 +0200 +++ b/Lib/sre_compile.py Tue Aug 31 21:26:35 2010 +0200 @@ -343,7 +343,7 @@ else: code = 'I' # Convert block indices to byte array of 256 bytes - mapping = array.array('b', mapping).tostring() + mapping = array.array('b', mapping).tobytes() # Convert byte array to word array mapping = array.array(code, mapping) assert mapping.itemsize == _sre.CODESIZE diff -r a90ea7e2f7b9 Lib/test/test_file.py --- a/Lib/test/test_file.py Tue Aug 31 21:10:39 2010 +0200 +++ b/Lib/test/test_file.py Tue Aug 31 21:26:35 2010 +0200 @@ -44,7 +44,7 @@ a = array('b', b'x'*10) self.f = self.open(TESTFN, 'rb') n = self.f.readinto(a) - self.assertEquals(b'12', a.tostring()[:n]) + self.assertEquals(b'12', a.tobytes()[:n]) def testReadinto_text(self): # verify readinto refuses text files @@ -281,7 +281,7 @@ except ValueError: self.fail("readinto() after next() with supposedly empty " "iteration-buffer failed anyway") - line = buf.tostring() + line = buf.tobytes() if line != testline: self.fail("readinto() after next() with empty buffer " "failed. Got %r, expected %r" % (line, testline)) diff -r a90ea7e2f7b9 Lib/test/test_io.py --- a/Lib/test/test_io.py Tue Aug 31 21:10:39 2010 +0200 +++ b/Lib/test/test_io.py Tue Aug 31 21:26:35 2010 +0200 @@ -480,7 +480,7 @@ def test_array_writes(self): a = array.array('i', range(10)) - n = len(a.tostring()) + n = len(a.tobytes()) with self.open(support.TESTFN, "wb", 0) as f: self.assertEqual(f.write(a), n) with self.open(support.TESTFN, "wb") as f: diff -r a90ea7e2f7b9 Lib/test/test_memoryio.py --- a/Lib/test/test_memoryio.py Tue Aug 31 21:10:39 2010 +0200 +++ b/Lib/test/test_memoryio.py Tue Aug 31 21:26:35 2010 +0200 @@ -425,7 +425,7 @@ a = array.array('b', b"hello world") memio = self.ioclass(buf) memio.readinto(a) - self.assertEqual(a.tostring(), b"1234567890d") + self.assertEqual(a.tobytes(), b"1234567890d") memio.close() self.assertRaises(ValueError, memio.readinto, b) diff -r a90ea7e2f7b9 Lib/test/test_memoryview.py --- a/Lib/test/test_memoryview.py Tue Aug 31 21:10:39 2010 +0200 +++ b/Lib/test/test_memoryview.py Tue Aug 31 21:26:35 2010 +0200 @@ -231,7 +231,7 @@ class BaseArrayMemoryTests(AbstractMemoryTests): ro_type = None rw_type = lambda self, b: array.array('i', list(b)) - getitem_type = lambda self, b: array.array('i', list(b)).tostring() + getitem_type = lambda self, b: array.array('i', list(b)).tobytes() itemsize = array.array('i').itemsize format = 'i' diff -r a90ea7e2f7b9 Lib/test/test_struct.py --- a/Lib/test/test_struct.py Tue Aug 31 21:10:39 2010 +0200 +++ b/Lib/test/test_struct.py Tue Aug 31 21:26:35 2010 +0200 @@ -430,12 +430,12 @@ # Test without offset s.pack_into(writable_buf, 0, test_string) - from_buf = writable_buf.tostring()[:len(test_string)] + from_buf = writable_buf.tobytes()[:len(test_string)] self.assertEqual(from_buf, test_string) # Test with offset. s.pack_into(writable_buf, 10, test_string) - from_buf = writable_buf.tostring()[:len(test_string)+10] + from_buf = writable_buf.tobytes()[:len(test_string)+10] self.assertEqual(from_buf, test_string[:10] + test_string) # Go beyond boundaries. @@ -458,12 +458,12 @@ # Test without offset. pack_into(writable_buf, 0, test_string) - from_buf = writable_buf.tostring()[:len(test_string)] + from_buf = writable_buf.tobytes()[:len(test_string)] self.assertEqual(from_buf, test_string) # Test with offset. pack_into(writable_buf, 10, test_string) - from_buf = writable_buf.tostring()[:len(test_string)+10] + from_buf = writable_buf.tobytes()[:len(test_string)+10] self.assertEqual(from_buf, test_string[:10] + test_string) # Go beyond boundaries. diff -r a90ea7e2f7b9 Lib/wave.py --- a/Lib/wave.py Tue Aug 31 21:10:39 2010 +0200 +++ b/Lib/wave.py Tue Aug 31 21:26:35 2010 +0200 @@ -248,7 +248,7 @@ chunk = chunk.file chunk.size_read = chunk.size_read + nitems * self._sampwidth data.byteswap() - data = data.tostring() + data = data.tobytes() else: data = self._data_chunk.read(nframes * self._framesize) if self._convert and data: