[Python-Dev] [Python-checkins] cpython: When expandtabs() would be a no-op, don't create a duplicate string

Éric Araujo merwok at netwok.org
Thu Oct 6 15:42:34 CEST 2011


Hi,

> http://hg.python.org/cpython/rev/447f521ac6d9
> user:        Antoine Pitrou <solipsis at pitrou.net>
> date:        Tue Oct 04 16:04:01 2011 +0200
> summary:
>   When expandtabs() would be a no-op, don't create a duplicate string
> 
> diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
> --- a/Lib/test/test_unicode.py
> +++ b/Lib/test/test_unicode.py
> @@ -1585,6 +1585,10 @@
>              return
>          self.assertRaises(OverflowError, 't\tt\t'.expandtabs, sys.maxsize)
>  
> +    def test_expandtabs_optimization(self):
> +        s = 'abc'
> +        self.assertIs(s.expandtabs(), s)

Shouldn’t that be marked CPython-specific?


More information about the Python-Dev mailing list