[pypy-svn] r49305 - in pypy/dist/pypy/rlib: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Mon Dec 3 00:09:49 CET 2007
Author: cfbolz
Date: Mon Dec 3 00:09:49 2007
New Revision: 49305
Modified:
pypy/dist/pypy/rlib/rope.py
pypy/dist/pypy/rlib/test/test_rope.py
Log:
don't search when the pattern string is longer than the search string
Modified: pypy/dist/pypy/rlib/rope.py
==============================================================================
--- pypy/dist/pypy/rlib/rope.py (original)
+++ pypy/dist/pypy/rlib/rope.py Mon Dec 3 00:09:49 2007
@@ -698,6 +698,8 @@
if (stop - start) < 0:
return -1
return start
+ if len2 >= stop - start:
+ return -1
restart = construct_restart_positions_node(subnode)
return _find_node(node, subnode, start, stop, restart)
Modified: pypy/dist/pypy/rlib/test/test_rope.py
==============================================================================
--- pypy/dist/pypy/rlib/test/test_rope.py (original)
+++ pypy/dist/pypy/rlib/test/test_rope.py Mon Dec 3 00:09:49 2007
@@ -437,6 +437,8 @@
LiteralStringNode("bacbb"))
pos = find(node, LiteralStringNode("a"), 0, node.length())
assert pos == 6
+ pos = find(node, LiteralStringNode("aaa"), 0, 2)
+ assert pos == -1
def test_find_unicode():
More information about the pypy-svn
mailing list