Author: Philip Jenvey <pjen...@underboss.org> Branch: Changeset: r84566:d7b4ace71d7e Date: 2016-05-21 16:29 -0700 http://bitbucket.org/pypy/pypy/changeset/d7b4ace71d7e/
Log: kill w_self diff --git a/pypy/module/_cffi_backend/ctypeobj.py b/pypy/module/_cffi_backend/ctypeobj.py --- a/pypy/module/_cffi_backend/ctypeobj.py +++ b/pypy/module/_cffi_backend/ctypeobj.py @@ -233,10 +233,9 @@ # __________ app-level attributes __________ def dir(self): space = self.space - w_self = space.wrap(self) lst = [space.wrap(name) for name in _name_of_attributes - if space.findattr(w_self, space.wrap(name)) is not None] + if space.findattr(self, space.wrap(name)) is not None] return space.newlist(lst) def _fget(self, attrchar): diff --git a/pypy/module/_collections/interp_deque.py b/pypy/module/_collections/interp_deque.py --- a/pypy/module/_collections/interp_deque.py +++ b/pypy/module/_collections/interp_deque.py @@ -389,20 +389,18 @@ def copy(self): "Return a shallow copy of a deque." space = self.space - w_self = space.wrap(self) if self.maxlen == sys.maxint: - return space.call_function(space.type(w_self), w_self) + return space.call_function(space.type(self), self) else: - return space.call_function(space.type(w_self), w_self, + return space.call_function(space.type(self), self, space.wrap(self.maxlen)) def reduce(self): "Return state information for pickling." space = self.space - w_self = space.wrap(self) - w_type = space.type(w_self) - w_dict = space.findattr(w_self, space.wrap('__dict__')) - w_list = space.call_function(space.w_list, w_self) + w_type = space.type(self) + w_dict = space.findattr(self, space.wrap('__dict__')) + w_list = space.call_function(space.w_list, self) if w_dict is None: if self.maxlen == sys.maxint: result = [ diff --git a/pypy/module/_weakref/interp__weakref.py b/pypy/module/_weakref/interp__weakref.py --- a/pypy/module/_weakref/interp__weakref.py +++ b/pypy/module/_weakref/interp__weakref.py @@ -156,12 +156,12 @@ class W_WeakrefBase(W_Root): - def __init__(w_self, space, w_obj, w_callable): + def __init__(self, space, w_obj, w_callable): assert w_callable is not space.w_None # should be really None - w_self.space = space + self.space = space assert w_obj is not None - w_self.w_obj_weak = weakref.ref(w_obj) - w_self.w_callable = w_callable + self.w_obj_weak = weakref.ref(w_obj) + self.w_callable = w_callable @jit.dont_look_inside def dereference(self): @@ -171,8 +171,8 @@ def clear(self): self.w_obj_weak = dead_ref - def activate_callback(w_self): - w_self.space.call_function(w_self.w_callable, w_self) + def activate_callback(self): + self.space.call_function(self.w_callable, self) def descr__repr__(self, space): w_obj = self.dereference() @@ -189,9 +189,9 @@ class W_Weakref(W_WeakrefBase): - def __init__(w_self, space, w_obj, w_callable): - W_WeakrefBase.__init__(w_self, space, w_obj, w_callable) - w_self.w_hash = None + def __init__(self, space, w_obj, w_callable): + W_WeakrefBase.__init__(self, space, w_obj, w_callable) + self.w_hash = None def descr__init__weakref(self, space, w_obj, w_callable=None, __args__=None): diff --git a/pypy/module/thread/os_local.py b/pypy/module/thread/os_local.py --- a/pypy/module/thread/os_local.py +++ b/pypy/module/thread/os_local.py @@ -50,10 +50,9 @@ self.dicts[ec] = w_dict # call __init__ try: - w_self = space.wrap(self) - w_type = space.type(w_self) + w_type = space.type(self) w_init = space.getattr(w_type, space.wrap("__init__")) - space.call_obj_args(w_init, w_self, self.initargs) + space.call_obj_args(w_init, self, self.initargs) except: # failed, forget w_dict and propagate the exception del self.dicts[ec] diff --git a/pypy/objspace/std/dictproxyobject.py b/pypy/objspace/std/dictproxyobject.py --- a/pypy/objspace/std/dictproxyobject.py +++ b/pypy/objspace/std/dictproxyobject.py @@ -12,8 +12,8 @@ erase = staticmethod(erase) unerase = staticmethod(unerase) - def __init__(w_self, space): - DictStrategy.__init__(w_self, space) + def __init__(self, space): + DictStrategy.__init__(self, space) def getitem(self, w_dict, w_key): space = self.space diff --git a/pypy/objspace/std/noneobject.py b/pypy/objspace/std/noneobject.py --- a/pypy/objspace/std/noneobject.py +++ b/pypy/objspace/std/noneobject.py @@ -4,7 +4,7 @@ class W_NoneObject(W_Root): - def unwrap(w_self, space): + def unwrap(self, space): return None def descr_nonzero(self, space): diff --git a/pypy/objspace/std/sliceobject.py b/pypy/objspace/std/sliceobject.py --- a/pypy/objspace/std/sliceobject.py +++ b/pypy/objspace/std/sliceobject.py @@ -12,13 +12,13 @@ class W_SliceObject(W_Root): _immutable_fields_ = ['w_start', 'w_stop', 'w_step'] - def __init__(w_self, w_start, w_stop, w_step): + def __init__(self, w_start, w_stop, w_step): assert w_start is not None assert w_stop is not None assert w_step is not None - w_self.w_start = w_start - w_self.w_stop = w_stop - w_self.w_step = w_step + self.w_start = w_start + self.w_stop = w_stop + self.w_step = w_step def unwrap(w_slice, space): return slice(space.unwrap(w_slice.w_start), space.unwrap(w_slice.w_stop), space.unwrap(w_slice.w_step)) diff --git a/pypy/objspace/std/strbufobject.py b/pypy/objspace/std/strbufobject.py --- a/pypy/objspace/std/strbufobject.py +++ b/pypy/objspace/std/strbufobject.py @@ -26,10 +26,10 @@ else: return self.w_str._value - def __repr__(w_self): + def __repr__(self): """ representation for debugging purposes """ return "%s(%r[:%d])" % ( - w_self.__class__.__name__, w_self.builder, w_self.length) + self.__class__.__name__, self.builder, self.length) def unwrap(self, space): return self.force() diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py --- a/pypy/objspace/std/typeobject.py +++ b/pypy/objspace/std/typeobject.py @@ -153,223 +153,223 @@ w_new_function = None @dont_look_inside - def __init__(w_self, space, name, bases_w, dict_w, + def __init__(self, space, name, bases_w, dict_w, overridetypedef=None, force_new_layout=False): - w_self.space = space - w_self.name = name - w_self.bases_w = bases_w - w_self.dict_w = dict_w - w_self.hasdict = False - w_self.hasuserdel = False - w_self.weakrefable = False - w_self.w_doc = space.w_None - w_self.weak_subclasses = [] - w_self.flag_heaptype = False - w_self.flag_cpytype = False - w_self.flag_abstract = False - w_self.flag_sequence_bug_compat = False - w_self.flag_map_or_seq = '?' # '?' means "don't know, check otherwise" + self.space = space + self.name = name + self.bases_w = bases_w + self.dict_w = dict_w + self.hasdict = False + self.hasuserdel = False + self.weakrefable = False + self.w_doc = space.w_None + self.weak_subclasses = [] + self.flag_heaptype = False + self.flag_cpytype = False + self.flag_abstract = False + self.flag_sequence_bug_compat = False + self.flag_map_or_seq = '?' # '?' means "don't know, check otherwise" if overridetypedef is not None: assert not force_new_layout - layout = setup_builtin_type(w_self, overridetypedef) + layout = setup_builtin_type(self, overridetypedef) else: - layout = setup_user_defined_type(w_self, force_new_layout) - w_self.layout = layout + layout = setup_user_defined_type(self, force_new_layout) + self.layout = layout - if not is_mro_purely_of_types(w_self.mro_w): + if not is_mro_purely_of_types(self.mro_w): pass else: # the _version_tag should change, whenever the content of # dict_w of any of the types in the mro changes, or if the mro # itself changes - w_self._version_tag = VersionTag() + self._version_tag = VersionTag() from pypy.objspace.std.mapdict import DictTerminator, NoDictTerminator # if the typedef has a dict, then the rpython-class does all the dict # management, which means from the point of view of mapdict there is no # dict. However, W_InstanceObjects are an exception to this from pypy.module.__builtin__.interp_classobj import W_InstanceObject - typedef = w_self.layout.typedef - if (w_self.hasdict and not typedef.hasdict or + typedef = self.layout.typedef + if (self.hasdict and not typedef.hasdict or typedef is W_InstanceObject.typedef): - w_self.terminator = DictTerminator(space, w_self) + self.terminator = DictTerminator(space, self) else: - w_self.terminator = NoDictTerminator(space, w_self) + self.terminator = NoDictTerminator(space, self) def __repr__(self): "NOT_RPYTHON" return '<W_TypeObject %r at 0x%x>' % (self.name, id(self)) - def mutated(w_self, key): + def mutated(self, key): """ The type is being mutated. key is either the string containing the specific attribute which is being deleted/set or None to indicate a generic mutation. """ - space = w_self.space - assert w_self.is_heaptype() or w_self.is_cpytype() + space = self.space + assert self.is_heaptype() or self.is_cpytype() - w_self.uses_object_getattribute = False + self.uses_object_getattribute = False # ^^^ conservative default, fixed during real usage if (key is None or key == '__eq__' or key == '__cmp__' or key == '__hash__'): - w_self.compares_by_identity_status = UNKNOWN + self.compares_by_identity_status = UNKNOWN if space.config.objspace.std.newshortcut: - w_self.w_new_function = None + self.w_new_function = None - if w_self._version_tag is not None: - w_self._version_tag = VersionTag() + if self._version_tag is not None: + self._version_tag = VersionTag() - subclasses_w = w_self.get_subclasses() + subclasses_w = self.get_subclasses() for w_subclass in subclasses_w: assert isinstance(w_subclass, W_TypeObject) w_subclass.mutated(key) - def version_tag(w_self): - if not we_are_jitted() or w_self.is_heaptype(): - return w_self._version_tag + def version_tag(self): + if not we_are_jitted() or self.is_heaptype(): + return self._version_tag # prebuilt objects cannot get their version_tag changed - return w_self._pure_version_tag() + return self._pure_version_tag() @elidable_promote() - def _pure_version_tag(w_self): - return w_self._version_tag + def _pure_version_tag(self): + return self._version_tag - def getattribute_if_not_from_object(w_self): + def getattribute_if_not_from_object(self): """ this method returns the applevel __getattribute__ if that is not the one from object, in which case it returns None """ from pypy.objspace.descroperation import object_getattribute if not we_are_jitted(): - if not w_self.uses_object_getattribute: + if not self.uses_object_getattribute: # slow path: look for a custom __getattribute__ on the class - w_descr = w_self.lookup('__getattribute__') + w_descr = self.lookup('__getattribute__') # if it was not actually overriden in the class, we remember this # fact for the next time. - if w_descr is object_getattribute(w_self.space): - w_self.uses_object_getattribute = True + if w_descr is object_getattribute(self.space): + self.uses_object_getattribute = True else: return w_descr return None # in the JIT case, just use a lookup, because it is folded away # correctly using the version_tag - w_descr = w_self.lookup('__getattribute__') - if w_descr is not object_getattribute(w_self.space): + w_descr = self.lookup('__getattribute__') + if w_descr is not object_getattribute(self.space): return w_descr - def has_object_getattribute(w_self): - return w_self.getattribute_if_not_from_object() is None + def has_object_getattribute(self): + return self.getattribute_if_not_from_object() is None - def compares_by_identity(w_self): + def compares_by_identity(self): from pypy.objspace.descroperation import object_hash, type_eq # - if w_self.compares_by_identity_status != UNKNOWN: + if self.compares_by_identity_status != UNKNOWN: # fast path - return w_self.compares_by_identity_status == COMPARES_BY_IDENTITY + return self.compares_by_identity_status == COMPARES_BY_IDENTITY # - default_hash = object_hash(w_self.space) - my_eq = w_self.lookup('__eq__') - overrides_eq = (my_eq and my_eq is not type_eq(w_self.space)) + default_hash = object_hash(self.space) + my_eq = self.lookup('__eq__') + overrides_eq = (my_eq and my_eq is not type_eq(self.space)) overrides_eq_cmp_or_hash = (overrides_eq or - w_self.lookup('__cmp__') or - w_self.lookup('__hash__') is not default_hash) + self.lookup('__cmp__') or + self.lookup('__hash__') is not default_hash) if overrides_eq_cmp_or_hash: - w_self.compares_by_identity_status = OVERRIDES_EQ_CMP_OR_HASH + self.compares_by_identity_status = OVERRIDES_EQ_CMP_OR_HASH else: - w_self.compares_by_identity_status = COMPARES_BY_IDENTITY - return w_self.compares_by_identity_status == COMPARES_BY_IDENTITY + self.compares_by_identity_status = COMPARES_BY_IDENTITY + return self.compares_by_identity_status == COMPARES_BY_IDENTITY - def ready(w_self): - for w_base in w_self.bases_w: + def ready(self): + for w_base in self.bases_w: if not isinstance(w_base, W_TypeObject): continue - w_base.add_subclass(w_self) + w_base.add_subclass(self) # compute a tuple that fully describes the instance layout - def get_full_instance_layout(w_self): - layout = w_self.layout - return (layout, w_self.hasdict, w_self.weakrefable) + def get_full_instance_layout(self): + layout = self.layout + return (layout, self.hasdict, self.weakrefable) - def compute_default_mro(w_self): - return compute_C3_mro(w_self.space, w_self) + def compute_default_mro(self): + return compute_C3_mro(self.space, self) - def getdictvalue(w_self, space, attr): - version_tag = w_self.version_tag() + def getdictvalue(self, space, attr): + version_tag = self.version_tag() if version_tag is not None: return unwrap_cell( space, - w_self._pure_getdictvalue_no_unwrapping( + self._pure_getdictvalue_no_unwrapping( space, version_tag, attr)) - w_value = w_self._getdictvalue_no_unwrapping(space, attr) + w_value = self._getdictvalue_no_unwrapping(space, attr) return unwrap_cell(space, w_value) - def _getdictvalue_no_unwrapping(w_self, space, attr): - w_value = w_self.dict_w.get(attr, None) - if w_self.lazyloaders and w_value is None: - if attr in w_self.lazyloaders: + def _getdictvalue_no_unwrapping(self, space, attr): + w_value = self.dict_w.get(attr, None) + if self.lazyloaders and w_value is None: + if attr in self.lazyloaders: # very clever next line: it forces the attr string # to be interned. space.new_interned_str(attr) - loader = w_self.lazyloaders[attr] - del w_self.lazyloaders[attr] + loader = self.lazyloaders[attr] + del self.lazyloaders[attr] w_value = loader() if w_value is not None: # None means no such attribute - w_self.dict_w[attr] = w_value + self.dict_w[attr] = w_value return w_value return w_value @elidable - def _pure_getdictvalue_no_unwrapping(w_self, space, version_tag, attr): - return w_self._getdictvalue_no_unwrapping(space, attr) + def _pure_getdictvalue_no_unwrapping(self, space, version_tag, attr): + return self._getdictvalue_no_unwrapping(space, attr) - def setdictvalue(w_self, space, name, w_value): - if not w_self.is_heaptype(): + def setdictvalue(self, space, name, w_value): + if not self.is_heaptype(): raise oefmt(space.w_TypeError, - "can't set attributes on type object '%N'", w_self) - if name == "__del__" and name not in w_self.dict_w: + "can't set attributes on type object '%N'", self) + if name == "__del__" and name not in self.dict_w: msg = ("a __del__ method added to an existing type will not be " "called") space.warn(space.wrap(msg), space.w_RuntimeWarning) - version_tag = w_self.version_tag() + version_tag = self.version_tag() if version_tag is not None: - w_curr = w_self._pure_getdictvalue_no_unwrapping( + w_curr = self._pure_getdictvalue_no_unwrapping( space, version_tag, name) w_value = write_cell(space, w_curr, w_value) if w_value is None: return True - w_self.mutated(name) - w_self.dict_w[name] = w_value + self.mutated(name) + self.dict_w[name] = w_value return True - def deldictvalue(w_self, space, key): - if w_self.lazyloaders: - w_self._cleanup_() # force un-lazification - if not w_self.is_heaptype(): + def deldictvalue(self, space, key): + if self.lazyloaders: + self._cleanup_() # force un-lazification + if not self.is_heaptype(): raise oefmt(space.w_TypeError, - "can't delete attributes on type object '%N'", w_self) + "can't delete attributes on type object '%N'", self) try: - del w_self.dict_w[key] + del self.dict_w[key] except KeyError: return False else: - w_self.mutated(key) + self.mutated(key) return True - def lookup(w_self, name): + def lookup(self, name): # note that this doesn't call __get__ on the result at all - space = w_self.space - return w_self.lookup_where_with_method_cache(name)[1] + space = self.space + return self.lookup_where_with_method_cache(name)[1] - def lookup_where(w_self, name): - space = w_self.space - return w_self.lookup_where_with_method_cache(name) + def lookup_where(self, name): + space = self.space + return self.lookup_where_with_method_cache(name) @unroll_safe - def lookup_starting_at(w_self, w_starttype, name): - space = w_self.space + def lookup_starting_at(self, w_starttype, name): + space = self.space look = False - for w_class in w_self.mro_w: + for w_class in self.mro_w: if w_class is w_starttype: look = True elif look: @@ -379,54 +379,54 @@ return None @unroll_safe - def _lookup(w_self, key): + def _lookup(self, key): # nowadays, only called from ../../tool/ann_override.py - space = w_self.space - for w_class in w_self.mro_w: + space = self.space + for w_class in self.mro_w: w_value = w_class.getdictvalue(space, key) if w_value is not None: return w_value return None @unroll_safe - def _lookup_where(w_self, key): + def _lookup_where(self, key): # like _lookup() but also returns the parent class in which the # attribute was found - space = w_self.space - for w_class in w_self.mro_w: + space = self.space + for w_class in self.mro_w: w_value = w_class.getdictvalue(space, key) if w_value is not None: return w_class, w_value return None, None - def _lookup_where_all_typeobjects(w_self, key): - # like _lookup_where(), but when we know that w_self.mro_w only + def _lookup_where_all_typeobjects(self, key): + # like _lookup_where(), but when we know that self.mro_w only # contains W_TypeObjects. (It differs from _lookup_where() mostly # from a JIT point of view: it cannot invoke arbitrary Python code.) - space = w_self.space - for w_class in w_self.mro_w: + space = self.space + for w_class in self.mro_w: assert isinstance(w_class, W_TypeObject) w_value = w_class._getdictvalue_no_unwrapping(space, key) if w_value is not None: return w_class, w_value return None, None - def lookup_where_with_method_cache(w_self, name): - space = w_self.space - promote(w_self) - version_tag = promote(w_self.version_tag()) + def lookup_where_with_method_cache(self, name): + space = self.space + promote(self) + version_tag = promote(self.version_tag()) if version_tag is None: - tup = w_self._lookup_where(name) + tup = self._lookup_where(name) return tup - tup_w = w_self._pure_lookup_where_with_method_cache(name, version_tag) + tup_w = self._pure_lookup_where_with_method_cache(name, version_tag) w_class, w_value = tup_w if isinstance(w_value, MutableCell): return w_class, w_value.unwrap_cell(space) return tup_w # don't make a new tuple, reuse the old one @elidable - def _pure_lookup_where_with_method_cache(w_self, name, version_tag): - space = w_self.space + def _pure_lookup_where_with_method_cache(self, name, version_tag): + space = self.space cache = space.fromcache(MethodCache) SHIFT2 = r_uint.BITS - space.config.objspace.std.methodcachesizeexp SHIFT1 = SHIFT2 - 5 @@ -451,70 +451,70 @@ tup = cache.lookup_where[method_hash] if space.config.objspace.std.withmethodcachecounter: cache.hits[name] = cache.hits.get(name, 0) + 1 -# print "hit", w_self, name +# print "hit", self, name return tup - tup = w_self._lookup_where_all_typeobjects(name) + tup = self._lookup_where_all_typeobjects(name) cache.versions[method_hash] = version_tag cache.names[method_hash] = name cache.lookup_where[method_hash] = tup if space.config.objspace.std.withmethodcachecounter: cache.misses[name] = cache.misses.get(name, 0) + 1 -# print "miss", w_self, name +# print "miss", self, name return tup - def check_user_subclass(w_self, w_subtype): - space = w_self.space + def check_user_subclass(self, w_subtype): + space = self.space if not isinstance(w_subtype, W_TypeObject): raise oefmt(space.w_TypeError, "X is not a type object ('%T')", w_subtype) - if not w_subtype.issubtype(w_self): + if not w_subtype.issubtype(self): raise oefmt(space.w_TypeError, "%N.__new__(%N): %N is not a subtype of %N", - w_self, w_subtype, w_subtype, w_self) - if w_self.layout.typedef is not w_subtype.layout.typedef: + self, w_subtype, w_subtype, self) + if self.layout.typedef is not w_subtype.layout.typedef: raise oefmt(space.w_TypeError, "%N.__new__(%N) is not safe, use %N.__new__()", - w_self, w_subtype, w_subtype) + self, w_subtype, w_subtype) return w_subtype - def _cleanup_(w_self): + def _cleanup_(self): "NOT_RPYTHON. Forces the lazy attributes to be computed." - if 'lazyloaders' in w_self.__dict__: - for attr in w_self.lazyloaders.keys(): - w_self.getdictvalue(w_self.space, attr) - del w_self.lazyloaders + if 'lazyloaders' in self.__dict__: + for attr in self.lazyloaders.keys(): + self.getdictvalue(self.space, attr) + del self.lazyloaders - def getdict(w_self, space): # returning a dict-proxy! + def getdict(self, space): # returning a dict-proxy! from pypy.objspace.std.dictproxyobject import DictProxyStrategy from pypy.objspace.std.dictmultiobject import W_DictObject - if w_self.lazyloaders: - w_self._cleanup_() # force un-lazification + if self.lazyloaders: + self._cleanup_() # force un-lazification strategy = space.fromcache(DictProxyStrategy) - storage = strategy.erase(w_self) + storage = strategy.erase(self) return W_DictObject(space, strategy, storage) - def is_heaptype(w_self): - return w_self.flag_heaptype + def is_heaptype(self): + return self.flag_heaptype - def is_cpytype(w_self): - return w_self.flag_cpytype + def is_cpytype(self): + return self.flag_cpytype - def is_abstract(w_self): - return w_self.flag_abstract + def is_abstract(self): + return self.flag_abstract - def set_abstract(w_self, abstract): - w_self.flag_abstract = bool(abstract) + def set_abstract(self, abstract): + self.flag_abstract = bool(abstract) - def issubtype(w_self, w_type): - promote(w_self) + def issubtype(self, w_type): + promote(self) promote(w_type) if we_are_jitted(): - version_tag1 = w_self.version_tag() + version_tag1 = self.version_tag() version_tag2 = w_type.version_tag() if version_tag1 is not None and version_tag2 is not None: - res = _pure_issubtype(w_self, w_type, version_tag1, version_tag2) + res = _pure_issubtype(self, w_type, version_tag1, version_tag2) return res - return _issubtype(w_self, w_type) + return _issubtype(self, w_type) def get_module(self): space = self.space @@ -538,8 +538,8 @@ else: return self.name - def add_subclass(w_self, w_subclass): - space = w_self.space + def add_subclass(self, w_subclass): + space = self.space if not space.config.translation.rweakref: # We don't have weakrefs! In this case, every class stores # subclasses in a non-weak list. ALL CLASSES LEAK! To make @@ -552,26 +552,26 @@ assert isinstance(w_subclass, W_TypeObject) newref = weakref.ref(w_subclass) - for i in range(len(w_self.weak_subclasses)): - ref = w_self.weak_subclasses[i] + for i in range(len(self.weak_subclasses)): + ref = self.weak_subclasses[i] if ref() is None: - w_self.weak_subclasses[i] = newref + self.weak_subclasses[i] = newref return else: - w_self.weak_subclasses.append(newref) + self.weak_subclasses.append(newref) - def remove_subclass(w_self, w_subclass): - space = w_self.space - for i in range(len(w_self.weak_subclasses)): - ref = w_self.weak_subclasses[i] + def remove_subclass(self, w_subclass): + space = self.space + for i in range(len(self.weak_subclasses)): + ref = self.weak_subclasses[i] if ref() is w_subclass: - del w_self.weak_subclasses[i] + del self.weak_subclasses[i] return - def get_subclasses(w_self): - space = w_self.space + def get_subclasses(self): + space = self.space subclasses_w = [] - for ref in w_self.weak_subclasses: + for ref in self.weak_subclasses: w_ob = ref() if w_ob is not None: subclasses_w.append(w_ob) diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py --- a/pypy/objspace/std/unicodeobject.py +++ b/pypy/objspace/std/unicodeobject.py @@ -28,22 +28,22 @@ import_from_mixin(StringMethods) _immutable_fields_ = ['_value'] - def __init__(w_self, unistr): + def __init__(self, unistr): assert isinstance(unistr, unicode) - w_self._value = unistr + self._value = unistr - def __repr__(w_self): + def __repr__(self): """representation for debugging purposes""" - return "%s(%r)" % (w_self.__class__.__name__, w_self._value) + return "%s(%r)" % (self.__class__.__name__, self._value) - def unwrap(w_self, space): + def unwrap(self, space): # for testing - return w_self._value + return self._value - def create_if_subclassed(w_self): - if type(w_self) is W_UnicodeObject: - return w_self - return W_UnicodeObject(w_self._value) + def create_if_subclassed(self): + if type(self) is W_UnicodeObject: + return self + return W_UnicodeObject(self._value) def is_w(self, space, w_other): if not isinstance(w_other, W_UnicodeObject): @@ -78,8 +78,8 @@ charbuf_w = str_w - def listview_unicode(w_self): - return _create_list_from_unicode(w_self._value) + def listview_unicode(self): + return _create_list_from_unicode(self._value) def ord(self, space): if len(self._value) != 1: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit