[pypy-commit] pypy typed-cells: rename the classes
cfbolz
noreply at buildbot.pypy.org
Wed Jan 21 18:54:51 CET 2015
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: typed-cells
Changeset: r75469:43929ae70123
Date: 2015-01-21 18:37 +0100
http://bitbucket.org/pypy/pypy/changeset/43929ae70123/
Log: rename the classes
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -8,7 +8,7 @@
W_DictMultiObject, DictStrategy, ObjectDictStrategy, BaseKeyIterator,
BaseValueIterator, BaseItemIterator, _never_equal_to_string
)
-from pypy.objspace.std.typeobject import TypeCell
+from pypy.objspace.std.typeobject import MutableCell
# ____________________________________________________________
@@ -872,15 +872,15 @@
if version_tag is not None:
name = space.str_w(w_name)
# We need to care for obscure cases in which the w_descr is
- # a TypeCell, which may change without changing the version_tag
+ # a MutableCell, which may change without changing the version_tag
_, w_descr = w_type._pure_lookup_where_possibly_with_method_cache(
name, version_tag)
#
selector = ("", INVALID)
if w_descr is None:
selector = (name, DICT) # common case: no such attr in the class
- elif isinstance(w_descr, TypeCell):
- pass # we have a TypeCell in the class: give up
+ elif isinstance(w_descr, MutableCell):
+ pass # we have a MutableCell in the class: give up
elif space.is_data_descr(w_descr):
# we have a data descriptor, which means the dictionary value
# (if any) has no relevance.
@@ -929,11 +929,11 @@
# We know here that w_obj.getdictvalue(space, name) just returned None,
# so the 'name' is not in the instance. We repeat the lookup to find it
# in the class, this time taking care of the result: it can be either a
- # quasi-constant class attribute, or actually a TypeCell --- which we
+ # quasi-constant class attribute, or actually a MutableCell --- which we
# must not cache. (It should not be None here, but you never know...)
_, w_method = w_type._pure_lookup_where_possibly_with_method_cache(
name, version_tag)
- if w_method is None or isinstance(w_method, TypeCell):
+ if w_method is None or isinstance(w_method, MutableCell):
return
_fill_cache(pycode, nameindex, map, version_tag, -1, w_method)
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
@@ -11,18 +11,18 @@
from rpython.rlib.objectmodel import current_object_addr_as_int, compute_hash
from rpython.rlib.rarithmetic import intmask, r_uint
-class BaseTypeCell(W_Root):
+class MutableCell(W_Root):
def unwrap_cell(self, space):
raise NotImplementedError("abstract base")
-class TypeCell(BaseTypeCell):
+class ObjectMutableCell(MutableCell):
def __init__(self, w_value=None):
self.w_value = w_value
def unwrap_cell(self, space):
return self.w_value
-class IntTypeCell(BaseTypeCell):
+class IntMutableCell(MutableCell):
def __init__(self, intvalue):
self.intvalue = intvalue
@@ -32,16 +32,16 @@
def unwrap_cell(space, w_value):
if space.config.objspace.std.withtypeversion:
- if isinstance(w_value, BaseTypeCell):
+ if isinstance(w_value, MutableCell):
return w_value.unwrap_cell(space)
return w_value
def write_cell(space, w_cell, w_value):
from pypy.objspace.std.intobject import W_IntObject
- if isinstance(w_cell, TypeCell):
+ if isinstance(w_cell, ObjectMutableCell):
w_cell.w_value = w_value
return None
- elif isinstance(w_cell, IntTypeCell) and type(w_value) is W_IntObject:
+ elif isinstance(w_cell, IntMutableCell) and type(w_value) is W_IntObject:
w_cell.intvalue = w_value.intval
return None
elif space.is_w(w_cell, w_value):
@@ -49,9 +49,9 @@
# create a level of indirection, or mutate the version.
return None
if type(w_value) is W_IntObject:
- return IntTypeCell(w_value.intval)
+ return IntMutableCell(w_value.intval)
else:
- return TypeCell(w_value)
+ return ObjectMutableCell(w_value)
class VersionTag(object):
pass
@@ -397,7 +397,7 @@
tup_w = w_self._pure_lookup_where_with_method_cache(name, version_tag)
w_class, w_value = tup_w
if (space.config.objspace.std.withtypeversion and
- isinstance(w_value, BaseTypeCell)):
+ 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
More information about the pypy-commit
mailing list