[pypy-svn] r8349 - pypy/branch/src-typedunwrap/pypy/objspace/std
pedronis at codespeak.net
pedronis at codespeak.net
Mon Jan 17 20:12:40 CET 2005
Author: pedronis
Date: Mon Jan 17 20:12:39 2005
New Revision: 8349
Modified:
pypy/branch/src-typedunwrap/pypy/objspace/std/objecttype.py
pypy/branch/src-typedunwrap/pypy/objspace/std/typeobject.py
pypy/branch/src-typedunwrap/pypy/objspace/std/typetype.py
Log:
done (for now) with objspace/std
next:
module and unwrapping signatures for gateways
open:
do we want to rename the generic unwrap to make it clearer that is
not meant to be translated
more appropriate name for unwrap_builtin
Modified: pypy/branch/src-typedunwrap/pypy/objspace/std/objecttype.py
==============================================================================
--- pypy/branch/src-typedunwrap/pypy/objspace/std/objecttype.py (original)
+++ pypy/branch/src-typedunwrap/pypy/objspace/std/objecttype.py Mon Jan 17 20:12:39 2005
@@ -7,8 +7,8 @@
def descr__repr__(space, w_obj):
w = space.wrap
- classname = space.unwrap(space.getattr(space.type(w_obj), w("__name__")))
- id = space.unwrap(space.id(w_obj))
+ 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
return w("<%s object at 0x%x>" % (classname, id))
def descr__str__(space, w_obj):
@@ -16,6 +16,7 @@
def descr__hash__(space, w_obj):
# XXX detect non-hashable instances (the ones overriding comparison only)
+ # XXX ids could be long
return space.id(w_obj)
def descr__class__(space, w_obj):
Modified: pypy/branch/src-typedunwrap/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/branch/src-typedunwrap/pypy/objspace/std/typeobject.py (original)
+++ pypy/branch/src-typedunwrap/pypy/objspace/std/typeobject.py Mon Jan 17 20:12:39 2005
@@ -129,7 +129,7 @@
return space.wrap("<pypy type '%s'>" % w_obj.name) # XXX remove 'pypy'
def getattr__Type_ANY(space, w_type, w_name):
- name = space.unwrap(w_name)
+ name = space.str_w(w_name)
w_descr = space.lookup(w_type, name)
if w_descr is not None:
if space.is_data_descr(w_descr):
@@ -143,7 +143,7 @@
raise OperationError(space.w_AttributeError,w_name)
def setattr__Type_ANY_ANY(space, w_type, w_name, w_value):
- name = space.unwrap(w_name)
+ name = space.str_w(w_name)
w_descr = space.lookup(w_type, name)
if w_descr is not None:
if space.is_data_descr(w_descr):
@@ -151,7 +151,7 @@
w_type.dict_w[name] = w_value
def delattr__Type_ANY(space, w_type, w_name):
- name = space.unwrap(w_name)
+ name = space.str_w(w_name)
w_descr = space.lookup(w_type, name)
if w_descr is not None:
if space.is_data_descr(w_descr):
Modified: pypy/branch/src-typedunwrap/pypy/objspace/std/typetype.py
==============================================================================
--- pypy/branch/src-typedunwrap/pypy/objspace/std/typetype.py (original)
+++ pypy/branch/src-typedunwrap/pypy/objspace/std/typetype.py Mon Jan 17 20:12:39 2005
@@ -6,14 +6,13 @@
"This is used to create user-defined classes only."
from pypy.objspace.std.typeobject import W_TypeObject
# XXX check types
- name = space.unwrap(w_name)
+ name = space.str_w(w_name)
assert isinstance(name, str)
bases_w = space.unpackiterable(w_bases)
dict_w = {}
dictkeys_w = space.unpackiterable(w_dict)
for w_key in dictkeys_w:
- key = space.unwrap(w_key)
- assert isinstance(key, str)
+ key = space.str_w(w_key)
dict_w[key] = space.getitem(w_dict, w_key)
w_type = space.allocate_instance(W_TypeObject, w_typetype)
w_type.__init__(space, name, bases_w or [space.w_object], dict_w)
More information about the Pypy-commit
mailing list