[pypy-commit] pypy default: better name for application representation of list strategies
l.diekmann
noreply at buildbot.pypy.org
Thu Dec 1 12:22:10 CET 2011
Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch:
Changeset: r50033:92f0d0594f88
Date: 2011-12-01 12:21 +0100
http://bitbucket.org/pypy/pypy/changeset/92f0d0594f88/
Log: better name for application representation of list strategies
diff --git a/pypy/module/__pypy__/interp_magic.py b/pypy/module/__pypy__/interp_magic.py
--- a/pypy/module/__pypy__/interp_magic.py
+++ b/pypy/module/__pypy__/interp_magic.py
@@ -4,7 +4,6 @@
from pypy.rlib.objectmodel import we_are_translated
from pypy.objspace.std.typeobject import MethodCache
from pypy.objspace.std.mapdict import IndexCache
-from pypy.objspace.std.listobject import W_ListObject, IntegerListStrategy, StringListStrategy, FloatListStrategy, RangeListStrategy, EmptyListStrategy, ObjectListStrategy
def internal_repr(space, w_object):
return space.wrap('%r' % (w_object,))
@@ -75,7 +74,8 @@
return space.wrap(42)
def list_strategy(space, w_list):
+ from pypy.objspace.std.listobject import W_ListObject
str_type = None
if isinstance(w_list, W_ListObject):
- str_type = w_list.strategy._type
+ str_type = w_list.strategy._applevel_repr
return space.wrap(str_type)
diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -326,7 +326,7 @@
to the added item.
W_Lists do not switch back to EmptyListStrategy when becoming empty again."""
- _type = "empty"
+ _applevel_repr = "empty"
def __init__(self, space):
ListStrategy.__init__(self, space)
@@ -428,7 +428,7 @@
On any operation destroying the range (inserting, appending non-ints)
the strategy is switched to IntegerListStrategy."""
- _type = "range"
+ _applevel_repr = "range"
def switch_to_integer_strategy(self, w_list):
items = self._getitems_range(w_list, False)
@@ -868,7 +868,7 @@
class ObjectListStrategy(AbstractUnwrappedStrategy, ListStrategy):
_none_value = None
- _type = "object"
+ _applevel_repr = "object"
def unwrap(self, w_obj):
return w_obj
@@ -897,7 +897,7 @@
class IntegerListStrategy(AbstractUnwrappedStrategy, ListStrategy):
_none_value = 0
- _type = "int"
+ _applevel_repr = "int"
def wrap(self, intval):
return self.space.wrap(intval)
@@ -924,7 +924,7 @@
class FloatListStrategy(AbstractUnwrappedStrategy, ListStrategy):
_none_value = 0.0
- _type = "float"
+ _applevel_repr = "float"
def wrap(self, floatval):
return self.space.wrap(floatval)
@@ -951,7 +951,7 @@
class StringListStrategy(AbstractUnwrappedStrategy, ListStrategy):
_none_value = None
- _type = "str"
+ _applevel_repr = "str"
def wrap(self, stringval):
return self.space.wrap(stringval)
More information about the pypy-commit
mailing list