[pypy-svn] r10698 - pypy/dist/pypy/objspace/std
pedronis at codespeak.net
pedronis at codespeak.net
Fri Apr 15 19:25:48 CEST 2005
Author: pedronis
Date: Fri Apr 15 19:25:48 2005
New Revision: 10698
Modified:
pypy/dist/pypy/objspace/std/objecttype.py
pypy/dist/pypy/objspace/std/stringobject.py
Log:
for now use r_uint in place of fixid (we may need a r_huint for this)
fix cases mixing strings and W_StringObjects in lists passed to W_ListObject constructor in stringobject
Modified: pypy/dist/pypy/objspace/std/objecttype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objecttype.py (original)
+++ pypy/dist/pypy/objspace/std/objecttype.py Fri Apr 15 19:25:48 2005
@@ -3,14 +3,14 @@
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.register_all import register_all
from pypy.objspace.std.objspace import StdObjSpace
-from pypy.tool.uid import fixid
+from pypy.tool.rarithmetic import r_uint
def descr__repr__(space, w_obj):
w = space.wrap
classname = space.str_w(space.getattr(space.type(w_obj), w("__name__")))
id = space.int_w(space.id(w_obj))# xxx ids could be long
- id = fixid(id)
+ id = r_uint(id) # XXX what about sizeof(void*) > sizeof(long) !!
return w("<%s object at 0x%x>" % (classname, id))
def descr__str__(space, w_obj):
Modified: pypy/dist/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/stringobject.py (original)
+++ pypy/dist/pypy/objspace/std/stringobject.py Fri Apr 15 19:25:48 2005
@@ -283,12 +283,14 @@
inword = 1
pos = pos + 1
+ res_w = [None] * len(res)
for i in range(len(res)):
- res[i] = W_StringObject(space, res[i])
- return W_ListObject(space, res)
+ res_w[i] = W_StringObject(space, res[i])
+
+ return W_ListObject(space, res_w)
def str_split__String_String_ANY(space, w_self, w_by, w_maxsplit=-1):
- res = []
+ res_w = []
start = 0
value = w_self._value
by = w_by._value
@@ -308,18 +310,16 @@
#the find method,
if next < 0:
break
- res.append(value[start:next])
+ res_w.append(W_StringObject(space, value[start:next]))
start = next + bylen
#decrese the counter only then, when
#we don't have default maxsplit
if maxsplit > -1:
splitcount = splitcount - 1
- res.append(value[start:])
+ res_w.append(W_StringObject(space, value[start:]))
- for i in range(len(res)):
- res[i] = W_StringObject(w_self.space, res[i])
- return W_ListObject(w_self.space, res)
+ return W_ListObject(w_self.space, res_w)
def str_join__String_ANY(space, w_self, w_list):
list = space.unpackiterable(w_list)
More information about the Pypy-commit
mailing list