When expandtabs() would be a no-op, don't create a duplicate string

This commit is contained in:
Antoine Pitrou 2011-10-04 16:04:01 +02:00
parent 87a484caf5
commit e19aa388e8
2 changed files with 11 additions and 0 deletions

View file

@ -1585,6 +1585,10 @@ class UnicodeTest(string_tests.CommonTest,
return
self.assertRaises(OverflowError, 't\tt\t'.expandtabs, sys.maxsize)
def test_expandtabs_optimization(self):
s = 'abc'
self.assertIs(s.expandtabs(), s)
def test_raiseMemError(self):
if struct.calcsize('P') == 8:
# 64 bits pointers