Author: Brian Kearns <bdkea...@gmail.com> Branch: stdlib-2.7.6 Changeset: r69629:8903d4b0e55e Date: 2014-03-02 21:13 -0500 http://bitbucket.org/pypy/pypy/changeset/8903d4b0e55e/
Log: add sre overflow test diff --git a/pypy/module/_sre/test/test_app_sre.py b/pypy/module/_sre/test/test_app_sre.py --- a/pypy/module/_sre/test/test_app_sre.py +++ b/pypy/module/_sre/test/test_app_sre.py @@ -32,6 +32,10 @@ class AppTestSrePattern: + def setup_class(cls): + # This imports support_test_sre as the global "s" + init_app_test(cls, cls.space) + def test_copy(self): # copy support is disabled by default in _sre.c import re @@ -48,6 +52,16 @@ assert 2 == p.groups assert {"g": 2} == p.groupindex + def test_repeat_minmax_overflow(self): + import re + string = "x" * 100000 + assert re.match(r".{%d}" % (self.s.MAXREPEAT - 1), string) is None + assert re.match(r".{,%d}" % (self.s.MAXREPEAT - 1), string).span() == (0, 100000) + assert re.match(r".{%d,}?" % (self.s.MAXREPEAT - 1), string) is None + raises(OverflowError, re.compile, r".{%d}" % self.s.MAXREPEAT) + raises(OverflowError, re.compile, r".{,%d}" % self.s.MAXREPEAT) + raises(OverflowError, re.compile, r".{%d,}?" % self.s.MAXREPEAT) + def test_match_none(self): import re p = re.compile("bla") _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit