[pypy-svn] r62183 - pypy/branch/spy-graphic/pypy/lang/smalltalk
cfbolz at codespeak.net
cfbolz at codespeak.net
Thu Feb 26 14:01:58 CET 2009
Author: cfbolz
Date: Thu Feb 26 14:01:57 2009
New Revision: 62183
Modified:
pypy/branch/spy-graphic/pypy/lang/smalltalk/wrapper.py
Log:
some small fixes and comments
Modified: pypy/branch/spy-graphic/pypy/lang/smalltalk/wrapper.py
==============================================================================
--- pypy/branch/spy-graphic/pypy/lang/smalltalk/wrapper.py (original)
+++ pypy/branch/spy-graphic/pypy/lang/smalltalk/wrapper.py Thu Feb 26 14:01:57 2009
@@ -11,12 +11,14 @@
def read(self, index0):
try:
return self.w_self.fetch(self.space, index0)
+ # XXX Index error never raised after translation
except IndexError:
raise WrapperException("Unexpected instance layout. Too small")
def write(self, index0, w_new):
try:
self.w_self.store(self.space, index0, w_new)
+ # XXX Index error never raised after translation
except IndexError:
raise WrapperException("Unexpected instance layout. Too small")
@@ -51,12 +53,9 @@
class ProcessWrapper(LinkWrapper):
suspended_context, store_suspended_context = make_getter_setter(1)
+ priority = make_int_getter(2)
my_list, store_my_list = make_getter_setter(3)
- def priority(self):
- w_priority = self.read(2)
- return self.space.unwrap_int(w_priority)
-
def put_to_sleep(self):
sched = scheduler(self.space)
priority = self.priority()
@@ -90,7 +89,7 @@
def suspend(self, interp):
if self.is_active_process():
- assert self.my_list() is interp.space.w_nil
+ assert self.my_list().is_same_object(interp.space.w_nil)
w_process = scheduler(self.space).highest_priority_process()
process = ProcessWrapper(self.space, w_process).activate(interp)
else:
@@ -103,7 +102,7 @@
last_link, store_last_link = make_getter_setter(1)
def is_empty_list(self):
- return self.first_link() is self.space.w_nil
+ return self.first_link().is_same_object(self.space.w_nil)
def add_last_link(self, w_object):
if self.is_empty_list():
@@ -125,7 +124,7 @@
return w_first
def remove(self, w_link):
- if self.first_link() is w_link:
+ if self.first_link().is_same_object(w_link):
self.remove_first_link_of_list()
return
else:
More information about the Pypy-commit
mailing list