]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 77247 via svnmerge from
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 2 Jan 2010 21:51:33 +0000 (21:51 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 2 Jan 2010 21:51:33 +0000 (21:51 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77247 | antoine.pitrou | 2010-01-02 22:47:10 +0100 (sam., 02 janv. 2010) | 5 lines

  Add tests for issue #7458: str.rfind() would crash when called with an invalid
  start value.  The offending code itself was removed as part of #7462.
  This patch by Victor Stinner.
........

Lib/test/string_tests.py

index ea49e3827363ed7a9b682599735a2f20492faf85..4964248eade3dc4d80dda87a0c4bf5e08dddb367 100644 (file)
@@ -172,6 +172,9 @@ class BaseTest(unittest.TestCase):
         self.checkequal(-1, '', 'find', 'xx', 1, 1)
         self.checkequal(-1, '', 'find', 'xx', sys.maxsize, 0)
 
+        # issue 7458
+        self.checkequal(-1, 'ab', 'find', 'xxx', sys.maxsize + 1, 0)
+
         # For a variety of combinations,
         #    verify that str.find() matches __contains__
         #    and that the found substring is really at that location
@@ -240,6 +243,9 @@ class BaseTest(unittest.TestCase):
                 if loc != -1:
                     self.assertEqual(i[loc:loc+len(j)], j)
 
+        # issue 7458
+        self.checkequal(-1, 'ab', 'rfind', 'xxx', sys.maxsize + 1, 0)
+
     def test_index(self):
         self.checkequal(0, 'abcdefghiabc', 'index', '')
         self.checkequal(3, 'abcdefghiabc', 'index', 'def')