[pypy-svn] r47962 - in pypy/dist/pypy/lang/smalltalk: . test
arigo at codespeak.net
arigo at codespeak.net
Thu Oct 25 18:43:23 CEST 2007
Author: arigo
Date: Thu Oct 25 18:43:23 2007
New Revision: 47962
Modified:
pypy/dist/pypy/lang/smalltalk/shadow.py
pypy/dist/pypy/lang/smalltalk/test/test_shadow.py
Log:
(toon, arigo)
Keep the wrapped Symbol objects as keys of the methoddict
of the class shadows.
Modified: pypy/dist/pypy/lang/smalltalk/shadow.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/shadow.py (original)
+++ pypy/dist/pypy/lang/smalltalk/shadow.py Thu Oct 25 18:43:23 2007
@@ -95,11 +95,8 @@
for i in range(size):
w_selector = w_methoddict.fetch(constants.METHODDICT_NAMES_INDEX+i)
if w_selector is not objtable.w_nil:
- if not isinstance(w_selector, model.W_BytesObject):
- raise ClassShadowError("bogus selector in method dict")
- selector = w_selector.as_string()
w_compiledmethod = w_values.fetch(i)
- self.methoddict[selector] = w_compiledmethod
+ self.methoddict[w_selector] = w_compiledmethod
# for the rest, we need to reset invalid to False already so
# that cycles in the superclass and/or metaclass chains don't
# cause infinite recursion
Modified: pypy/dist/pypy/lang/smalltalk/test/test_shadow.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/test/test_shadow.py (original)
+++ pypy/dist/pypy/lang/smalltalk/test/test_shadow.py Thu Oct 25 18:43:23 2007
@@ -18,9 +18,8 @@
w_methoddict.store(constants.METHODDICT_VALUES_INDEX, w_array)
positions = range(size)
random.shuffle(positions)
- for selector, w_compiledmethod in methods.items():
+ for w_selector, w_compiledmethod in methods.items():
pos = positions.pop()
- w_selector = objtable.wrap_string(selector)
w_methoddict.store(constants.METHODDICT_NAMES_INDEX+pos, w_selector)
w_array.store(pos, w_compiledmethod)
#print w_methoddict._vars
@@ -63,8 +62,8 @@
yield basicshape, "CompiledMeth", 0xE02, shadow.COMPILED_METHOD, True, 0
def test_methoddict():
- methods = {'foo': 'foo_method',
- 'bar': 'bar_method'}
+ methods = {objtable.wrap_string('foo'): 'foo_method',
+ objtable.wrap_string('bar'): 'bar_method'}
w_class = build_smalltalk_class("Demo", 0x90, methods=methods)
classshadow = w_class.as_class_get_shadow()
assert classshadow.methoddict == methods
More information about the Pypy-commit
mailing list