[pypy-svn] r79883 - in pypy/branch/fast-forward/pypy/objspace/std: . test
agaynor at codespeak.net
agaynor at codespeak.net
Wed Dec 8 05:50:03 CET 2010
Author: agaynor
Date: Wed Dec 8 05:50:00 2010
New Revision: 79883
Modified:
pypy/branch/fast-forward/pypy/objspace/std/stringobject.py
pypy/branch/fast-forward/pypy/objspace/std/test/test_stringobject.py
Log:
Fix the other half of the various index taking methods on strings.
Modified: pypy/branch/fast-forward/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/stringobject.py (original)
+++ pypy/branch/fast-forward/pypy/objspace/std/stringobject.py Wed Dec 8 05:50:00 2010
@@ -387,6 +387,8 @@
def _convert_idx_params(space, w_self, w_sub, w_start, w_end, upper_bound=False):
self = w_self._value
sub = w_sub._value
+ if space.is_w(w_start, space.w_None):
+ w_start = space.wrap(0)
if space.is_w(w_end, space.w_None):
w_end = space.len(w_self)
if upper_bound:
Modified: pypy/branch/fast-forward/pypy/objspace/std/test/test_stringobject.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/test/test_stringobject.py (original)
+++ pypy/branch/fast-forward/pypy/objspace/std/test/test_stringobject.py Wed Dec 8 05:50:00 2010
@@ -414,6 +414,7 @@
assert 'abcdefghiabc'.index('abc', 1) == 9
assert 'abcdefghiabc'.index('def', -4*maxint, 4*maxint) == 3
assert 'abcdefgh'.index('def', 2, None) == 3
+ assert 'abcdefgh'.index('def', None, None) == 3
raises(ValueError, 'abcdefghiabc'.index, 'hib')
raises(ValueError, 'abcdefghiab'.index, 'abc', 1)
raises(ValueError, 'abcdefghi'.index, 'ghi', 8)
More information about the Pypy-commit
mailing list