[Python-checkins] r67291 - in python/trunk: Lib/test/test_bytes.py Misc/NEWS Objects/bytearrayobject.c

Nick Coghlan ncoghlan at gmail.com
Thu Nov 20 11:51:39 CET 2008


benjamin.peterson wrote:
> Author: benjamin.peterson
> Date: Wed Nov 19 22:49:09 2008
> New Revision: 67291
> 
> Log:
> make sure that bytearray methods return a new bytearray even if there is no change
> 
> Fixes #4348
> Reviewed by Brett
> 
> 
> Modified:
>    python/trunk/Lib/test/test_bytes.py
>    python/trunk/Misc/NEWS
>    python/trunk/Objects/bytearrayobject.c
> 
> Modified: python/trunk/Lib/test/test_bytes.py
> ==============================================================================
> --- python/trunk/Lib/test/test_bytes.py	(original)
> +++ python/trunk/Lib/test/test_bytes.py	Wed Nov 19 22:49:09 2008
> @@ -721,6 +721,16 @@
>          b.insert(0, Indexable(ord('A')))
>          self.assertEqual(b, b'A')
>  
> +    def test_copied(self):
> +        # Issue 4348.  Make sure that operations that don't mutate the array
> +        # copy the bytes.
> +        b = bytearray(b'abc')
> +        #self.assertFalse(b is b.replace(b'abc', b'cde', 0))
> +
> +        t = bytearray([i for i in range(256)])
> +        x = bytearray(b'')
> +        self.assertFalse(x is x.translate(t))

Why is the first test disabled?

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-checkins mailing list