Commits

Alexander Hesse  committed b4a8a57

Removed rpython.tool.compat, moved test_annmm to pypy.objspace.std.test

  • Participants
  • Parent commits c1e59dc
  • Branches split-rpython

Comments (0)

Files changed (8)

File pypy/objspace/std/test/test_annmm.py

+from pypy.objspace.std.multimethod import *
+from rpython.annotator.annrpython import RPythonAnnotator
+
+class W_Root(object):
+    pass
+
+class W_Int(W_Root):
+    pass
+
+class W_Str(W_Root):
+    pass
+
+
+str_w = MultiMethodTable(1, root_class=W_Root, argnames_before=['space'])
+int_w = MultiMethodTable(1, root_class=W_Root, argnames_before=['space'])
+
+
+def int_w__Int(space, w_x):
+    assert space == 'space'
+    assert isinstance(w_x, W_Int)
+    return 1
+
+def str_w__Str(space, w_x):
+    assert space == 'space'
+    assert isinstance(w_x, W_Str)
+    return "string"
+
+int_w.register(int_w__Int, W_Int)
+str_w.register(str_w__Str, W_Str)
+
+
+def setup_module(mod):
+    typeorder = {
+        W_Int: [(W_Int, None)],
+        W_Str: [(W_Str, None)],
+        }
+    mod.typeorder = typeorder
+    mod.str_w1 = str_w.install('__str_w', [typeorder])
+    mod.int_w1 = int_w.install('__int_w', [typeorder])
+
+
+def test_str_w_ann():
+    a = RPythonAnnotator()
+    s1 = a.build_types(str_w1,[str, W_Str])
+    s2 = a.build_types(str_w1,[str, W_Root])
+    assert s1.knowntype == str
+    assert s2.knowntype == str
+    
+def test_int_w_ann():
+    a = RPythonAnnotator()
+    s1 = a.build_types(int_w1,[str, W_Int])
+    s2 = a.build_types(int_w1,[str, W_Str])
+    assert s1.knowntype == int
+    assert s2.knowntype == int
+    
+    

File rpython/annotator/test/test_annmm.py

-from pypy.objspace.std.multimethod import *
-from rpython.annotator.annrpython import RPythonAnnotator
-
-class W_Root(object):
-    pass
-
-class W_Int(W_Root):
-    pass
-
-class W_Str(W_Root):
-    pass
-
-
-str_w = MultiMethodTable(1, root_class=W_Root, argnames_before=['space'])
-int_w = MultiMethodTable(1, root_class=W_Root, argnames_before=['space'])
-
-
-def int_w__Int(space, w_x):
-    assert space == 'space'
-    assert isinstance(w_x, W_Int)
-    return 1
-
-def str_w__Str(space, w_x):
-    assert space == 'space'
-    assert isinstance(w_x, W_Str)
-    return "string"
-
-int_w.register(int_w__Int, W_Int)
-str_w.register(str_w__Str, W_Str)
-
-
-def setup_module(mod):
-    typeorder = {
-        W_Int: [(W_Int, None)],
-        W_Str: [(W_Str, None)],
-        }
-    mod.typeorder = typeorder
-    mod.str_w1 = str_w.install('__str_w', [typeorder])
-    mod.int_w1 = int_w.install('__int_w', [typeorder])
-
-
-def test_str_w_ann():
-    a = RPythonAnnotator()
-    s1 = a.build_types(str_w1,[str, W_Str])
-    s2 = a.build_types(str_w1,[str, W_Root])
-    assert s1.knowntype == str
-    assert s2.knowntype == str
-    
-def test_int_w_ann():
-    a = RPythonAnnotator()
-    s1 = a.build_types(int_w1,[str, W_Int])
-    s2 = a.build_types(int_w1,[str, W_Str])
-    assert s1.knowntype == int
-    assert s2.knowntype == int
-    
-    

File rpython/jit/tl/jittest.py

 """
-This file is imported by pypy.translation.driver when running the
+This file is imported by rpython.translator.driver when running the
 target --jittest.  Feel free to hack it as needed; it is imported
 only after the '---> Checkpoint' fork.
 """

File rpython/tool/compat.py

-
-try:
-    # Preferred way since python 2.6
-    from hashlib import md5
-except ImportError:
-    try:
-        from md5 import md5
-    except ImportError:
-        # no _md5 module on this platform. Try hard to find a pure-python one
-        # by fishing it from lib_pypy
-        from pypy.tool.lib_pypy import import_from_lib_pypy
-        md5 = import_from_lib_pypy('md5')
-        del import_from_lib_pypy

File rpython/tool/gcc_cache.py

 from pypy.conftest import pypydir
 from rpython.translator.platform import CompilationError
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
-from rpython.tool.compat import md5
+from hashlib import md5
 import py
 
 cache_dir_root = py.path.local(pypydir).join('_cache').ensure(dir=1)

File rpython/translator/backendopt/stat.py

 from rpython.translator.simplify import get_graph
-from rpython.tool.compat import md5
+from hashlib import md5
 
 def get_statistics(graph, translator, save_per_graph_details=None, ignore_stack_checks=False):
     seen_graphs = {}

File rpython/translator/backendopt/support.py

     return loop
 
 def md5digest(translator):
-    from rpython.tool.compat import md5
+    from hashlib import md5
     graph2digest = {}
     for graph in translator.graphs:
         m = md5()

File rpython/translator/driver.py

         # print a message, and restart
         from rpython.translator.goal import unixcheckpoint
         unixcheckpoint.restartable_point(auto='run')
-        # load the module pypy/jit/tl/jittest.py, which you can hack at
+        # load the module rpython/jit/tl/jittest.py, which you can hack at
         # and restart without needing to restart the whole translation process
         from rpython.jit.tl import jittest
         jittest.jittest(self)