Author: Lars Wassermann <[email protected]>
Branch:
Changeset: r401:44ff7eb950d2
Date: 2013-05-22 09:46 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/44ff7eb950d2/
Log: changed the smalltalk value of the pc for returned, shadowed
contexts to w_nil
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -560,9 +560,12 @@
def wrap_pc(self):
pc = self.pc()
- pc += 1
- pc += self.s_method().bytecodeoffset
- return self.space.wrap_int(pc)
+ if pc == -1:
+ return self.space.w_nil
+ else:
+ pc += 1
+ pc += self.s_method().bytecodeoffset
+ return self.space.wrap_int(pc)
def pc(self):
return self._pc
diff --git a/spyvm/test/test_shadow.py b/spyvm/test/test_shadow.py
--- a/spyvm/test/test_shadow.py
+++ b/spyvm/test/test_shadow.py
@@ -275,3 +275,10 @@
assert s_class.lookup(key) is w_method.as_compiledmethod_get_shadow(space)
assert s_class.version is not version
assert s_class.version is w_parent.as_class_get_shadow(space).version
+
+def test_returned_contexts_pc():
+ w_context = methodcontext()
+ s_context = w_context.as_methodcontext_get_shadow(space)
+ assert w_context.fetch(space, constants.CTXPART_PC_INDEX) is not
space.w_nil
+ s_context.mark_returned()
+ assert w_context.fetch(space, constants.CTXPART_PC_INDEX) is space.w_nil
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit