[pypy-svn] r20347 - in pypy/branch/somepbc-refactoring/pypy/rpython: . test

mwh at codespeak.net mwh at codespeak.net
Mon Nov 28 13:00:55 CET 2005


Author: mwh
Date: Mon Nov 28 13:00:53 2005
New Revision: 20347

Modified:
   pypy/branch/somepbc-refactoring/pypy/rpython/rspecialcase.py
   pypy/branch/somepbc-refactoring/pypy/rpython/test/test_rspecialcase.py
Log:
usual prebuiltinstances -> descriptions style malarkey for 
{test_}rspecialcase.py.  deeper, not yet checked in changes
required for tests to actually pass, mind.


Modified: pypy/branch/somepbc-refactoring/pypy/rpython/rspecialcase.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/rspecialcase.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/rspecialcase.py	Mon Nov 28 13:00:53 2005
@@ -3,11 +3,11 @@
 
 
 def rtype_call_specialcase(hop):
-    s_function = hop.args_s[0]
-    if len(s_function.prebuiltinstances) != 1:
+    s_pbc = hop.args_s[0]
+    if len(s_pbc.descriptions) != 1:
         raise TyperError("not monomorphic call_specialcase")
-    func, clsdef = s_function.prebuiltinstances.items()[0]
-    tag = func._annspecialcase_
+    desc, = s_pbc.descriptions
+    tag = desc.pyobj._annspecialcase_
     if not tag.startswith("override:"):
         raise TyperError("call_specialcase only supports 'override:' functions")
     tag = tag[9:]
@@ -17,31 +17,31 @@
         raise TyperError("call_specialcase: unknown tag override:" + tag)
     hop2 = hop.copy()
     hop2.r_s_popfirstarg()
-    return rtype_override_fn(hop2, clsdef)
+    return rtype_override_fn(hop2)
 
 
 
-def rtype_override_ignore(hop, clsdef): # ignore works for methods too
+def rtype_override_ignore(hop): # ignore works for methods too
     hop.exception_cannot_occur()
     return inputconst(hop.r_result, None)
 
-def rtype_identity_function(hop, clsdef):
+def rtype_identity_function(hop):
     hop.exception_cannot_occur()
     v, = hop.inputargs(hop.args_r[0])
     return v
 
-def rtype_override_init_opaque_object(hop, clsdef):
+def rtype_override_init_opaque_object(hop):
     return hop.genop('init_opaque_object_should_never_be_seen_by_the_backend',
                      [], resulttype=hop.r_result)
 
-def rtype_override_from_opaque_object(hop, clsdef):
+def rtype_override_from_opaque_object(hop):
     return hop.genop('from_opaque_object_should_never_be_seen_by_the_backend',
                      [], resulttype=hop.r_result)
 
-def rtype_override_to_opaque_object(hop, clsdef):
+def rtype_override_to_opaque_object(hop):
     return hop.genop('to_opaque_object_should_never_be_seen_by_the_backend',
                      [], resulttype=hop.r_result)
 
-def rtype_override_yield_current_frame_to_caller(hop, clsdef):
+def rtype_override_yield_current_frame_to_caller(hop):
     return hop.genop('yield_current_frame_to_caller', [], 
                      resulttype=hop.r_result)

Modified: pypy/branch/somepbc-refactoring/pypy/rpython/test/test_rspecialcase.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/test/test_rspecialcase.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/test/test_rspecialcase.py	Mon Nov 28 13:00:53 2005
@@ -1,8 +1,6 @@
 from pypy.rpython.lltypesystem.lltype import *
 from pypy.rpython.test.test_llinterp import interpret, gengraph
 
-from pypy.translator.ann_override import PyPyAnnotatorPolicy
-
 
 def test_override_ignore():
     def f():
@@ -30,11 +28,10 @@
                 return f()
             except:
                 return "hello!"
-    t, typer = gengraph(g, [int])
+    t, typer, graph = gengraph(g, [int])
     from pypy.translator import simplify
     from pypy.translator.backendopt import removenoops
     from pypy.objspace.flow.model import checkgraph
-    graph = t.getflowgraph(g)
     removenoops.remove_same_as(graph)
     simplify.eliminate_empty_blocks(graph)
     #should not crash:



More information about the Pypy-commit mailing list