[pypy-svn] r62880 - pypy/trunk/pypy/lang/smalltalk

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Mar 12 12:43:41 CET 2009


Author: cfbolz
Date: Thu Mar 12 12:43:40 2009
New Revision: 62880

Modified:
   pypy/trunk/pypy/lang/smalltalk/primitives.py
   pypy/trunk/pypy/lang/smalltalk/wrapper.py
Log:
some tiny cleanups, an XXX


Modified: pypy/trunk/pypy/lang/smalltalk/primitives.py
==============================================================================
--- pypy/trunk/pypy/lang/smalltalk/primitives.py	(original)
+++ pypy/trunk/pypy/lang/smalltalk/primitives.py	Thu Mar 12 12:43:40 2009
@@ -299,7 +299,7 @@
 
 @expose_primitive(MAKE_POINT, unwrap_spec=[int, int])
 def func(interp, x, y):
-    w_res = interp.space.classtable['w_Point'].as_class_get_shadow(interp.space).new(2)
+    w_res = interp.space.w_Point.as_class_get_shadow(interp.space).new(2)
     point = wrapper.PointWrapper(interp.space, w_res)
     point.store_x(interp.space, x)
     point.store_y(interp.space, y)
@@ -771,7 +771,7 @@
 def func(interp, w_rcvr):
     # XXX we might want to disable this check
     if not w_rcvr.getclass(interp.space).is_same_object(
-        interp.space.classtable['w_Semaphore']):
+        interp.space.w_Semaphore):
         raise PrimitiveFailedError()
     wrapper.SemaphoreWrapper(interp.space, w_rcvr).signal(interp)
     return w_rcvr
@@ -780,7 +780,7 @@
 def func(interp, w_rcvr):
     # XXX we might want to disable this check
     if not w_rcvr.getclass(interp.space).is_same_object(
-        interp.space.classtable['w_Semaphore']):
+        interp.space.w_Semaphore):
         raise PrimitiveFailedError()
     wrapper.SemaphoreWrapper(interp.space, w_rcvr).wait(interp)
     return w_rcvr
@@ -789,7 +789,7 @@
 def func(interp, w_rcvr,):
     # XXX we might want to disable this check
     if not w_rcvr.getclass(interp.space).is_same_object(
-        interp.space.classtable['w_Process']):
+        interp.space.w_Process):
         raise PrimitiveFailedError()
     wrapper.ProcessWrapper(interp.space, w_rcvr).resume(interp)
     return w_rcvr
@@ -798,7 +798,7 @@
 def func(interp, w_rcvr):
     # XXX we might want to disable this check
     if not w_rcvr.getclass(interp.space).is_same_object(
-        interp.space.classtable['w_Process']):
+        interp.space.w_Process):
         raise PrimitiveFailedError()
     wrapper.ProcessWrapper(interp.space, w_rcvr).suspend(interp)
     return w_rcvr

Modified: pypy/trunk/pypy/lang/smalltalk/wrapper.py
==============================================================================
--- pypy/trunk/pypy/lang/smalltalk/wrapper.py	(original)
+++ pypy/trunk/pypy/lang/smalltalk/wrapper.py	Thu Mar 12 12:43:40 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()



More information about the Pypy-commit mailing list