[pypy-svn] r49588 - pypy/dist/pypy/objspace/std
cfbolz at codespeak.net
cfbolz at codespeak.net
Sun Dec 9 22:47:38 CET 2007
Author: cfbolz
Date: Sun Dec 9 22:47:38 2007
New Revision: 49588
Modified:
pypy/dist/pypy/objspace/std/ropeobject.py
Log:
more small optimizations
Modified: pypy/dist/pypy/objspace/std/ropeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/ropeobject.py (original)
+++ pypy/dist/pypy/objspace/std/ropeobject.py Sun Dec 9 22:47:38 2007
@@ -531,7 +531,7 @@
def str_endswith__Rope_Tuple_ANY_ANY(space, w_self, w_suffixes, w_start, w_end):
(self, _, start, end) = _convert_idx_params(space, w_self,
- space.wrap(''), w_start, w_end)
+ W_RopeObject.EMPTY, w_start, w_end)
for w_suffix in space.unpacktuple(w_suffixes):
if space.is_true(space.isinstance(w_suffix, space.w_unicode)):
w_u = space.call_function(space.w_unicode, w_self)
@@ -549,7 +549,7 @@
return space.newbool(rope.startswith(self, prefix, start, end))
def str_startswith__Rope_Tuple_ANY_ANY(space, w_self, w_prefixes, w_start, w_end):
- (self, _, start, end) = _convert_idx_params(space, w_self, space.wrap(''),
+ (self, _, start, end) = _convert_idx_params(space, w_self, W_RopeObject.EMPTY,
w_start, w_end)
for w_prefix in space.unpacktuple(w_prefixes):
if space.is_true(space.isinstance(w_prefix, space.w_unicode)):
@@ -741,7 +741,7 @@
space.w_TypeError,
space.wrap("ord() expected a character, but string "
"of length %d found"% (w_str._node.length(),)))
- return space.wrap(ord(node.flatten_string()[0]))
+ return space.wrap(node.getint(0))
def getnewargs__Rope(space, w_str):
return space.newtuple([W_RopeObject(w_str._node)])
@@ -853,7 +853,7 @@
raise OperationError(space.w_StopIteration, space.w_None)
try:
char = w_ropeiter.item_iter.nextchar()
- w_item = space.wrap(char)
+ w_item = wrapchar(space, char)
except StopIteration:
w_ropeiter.node = None
w_ropeiter.char_iter = None
More information about the Pypy-commit
mailing list