[pypy-svn] r48019 - pypy/dist/pypy/lang/smalltalk

lukas at codespeak.net lukas at codespeak.net
Fri Oct 26 10:33:48 CEST 2007


Author: lukas
Date: Fri Oct 26 10:33:47 2007
New Revision: 48019

Modified:
   pypy/dist/pypy/lang/smalltalk/primitives.py
Log:
(cfbolz,lr) made it possible to have failing primitives print something


Modified: pypy/dist/pypy/lang/smalltalk/primitives.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/primitives.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/primitives.py	Fri Oct 26 10:33:47 2007
@@ -39,13 +39,15 @@
 # primitive functions.  Each primitive function takes two
 # arguments, an interp and an argument_count
 # completes, and returns a result, or throws a PrimitiveFailedError.
-
-def raise_failing_default(interp, argument_count):
-    raise PrimitiveFailedError
+def make_failing(code):
+    def raise_failing_default(interp, argument_count):
+#        print "Primitive failed", code
+        raise PrimitiveFailedError
+    return raise_failing_default
 
 # Squeak has primitives all the way up to 575
 # So all optional primitives will default to the bytecode implementation
-prim_table = [raise_failing_default] * 576
+prim_table = [make_failing(i) for i in range(576)]
 
 def expose_primitive(code, unwrap_spec=None):
     # some serious magic, don't look
@@ -642,8 +644,8 @@
 def func(interp, w_rcvr, w_args):
     raise PrimitiveNotYetWrittenError()
 
- at expose_primitive(PRIMITIVE_PERFORM, unwrap_spec=[object, object])
-def func(interp, w_rcvr, w_sel):
+ at expose_primitive(PRIMITIVE_PERFORM)
+def func(interp, argument_count):
     # XXX we can implement this when lookup on shadow class is done
     raise PrimitiveNotYetWrittenError()
 



More information about the Pypy-commit mailing list