diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-06-11 02:16:10 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-06-11 02:16:10 +0000 |
commit | 5c9a81a3d828e775a1500bb8d84dc1dab59513ad (patch) | |
tree | 868a2214eae0f4ac5f30719a835a63d730fcfff8 /Lib/test/string_tests.py | |
parent | ba965deea89299611454e43be005df357b75b11d (diff) | |
download | cpython-git-5c9a81a3d828e775a1500bb8d84dc1dab59513ad.tar.gz |
Fix a bug when there was a newline in the string expandtabs was called on.
This also catches another condition that can overflow.
Will backport.
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r-- | Lib/test/string_tests.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index 3570ef102f..d38e4a98dd 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -247,8 +247,13 @@ class CommonTest(unittest.TestCase): self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs') self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs', 8) self.checkequal('abc\r\nab\r\ndef\ng\r\nhi', 'abc\r\nab\r\ndef\ng\r\nhi', 'expandtabs', 4) + self.checkequal(' a\n b', ' \ta\n\tb', 'expandtabs', 1) self.checkraises(TypeError, 'hello', 'expandtabs', 42, 42) + # This test is only valid when sizeof(int) == sizeof(void*) == 4. + if sys.maxint < (1 << 32) and struct.calcsize('P') == 4: + self.checkraises(OverflowError, + '\ta\n\tb', 'expandtabs', sys.maxint) def test_split(self): self.checkequal(['this', 'is', 'the', 'split', 'function'], |