[pypy-commit] pypy py3k: hg merge default

Manuel Jacob noreply at buildbot.pypy.org
Fri Jun 7 12:14:55 CEST 2013


Author: Manuel Jacob
Branch: py3k
Changeset: r64815:eb7f8348ff30
Date: 2013-06-07 11:43 +0200
http://bitbucket.org/pypy/pypy/changeset/eb7f8348ff30/

Log:	hg merge default

diff --git a/pypy/doc/getting-started-dev.rst b/pypy/doc/getting-started-dev.rst
--- a/pypy/doc/getting-started-dev.rst
+++ b/pypy/doc/getting-started-dev.rst
@@ -8,7 +8,8 @@
 interpreter is written mostly in RPython (with pieces in Python), while
 the RPython compiler is written in Python. The hard to understand part
 is that Python is a meta-programming language for RPython, that is,
-RPython is considered from live objects **after** the imports are done.
+"being valid RPython" is a question that only makes sense on the
+live objects **after** the imports are done.
 This might require more explanation. You start writing RPython from
 ``entry_point``, a good starting point is
 ``rpython/translator/goal/targetnopstandalone.py``. This does not do all that
@@ -37,7 +38,7 @@
 In this example ``entry_point`` is RPython,  ``add`` and ``sub`` are RPython,
 however, ``generator`` is not.
 
-A good introductory level articles are available:
+The following introductory level articles are available:
 
 * Laurence Tratt -- `Fast Enough VMs in Fast Enough Time`_.
 
diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -994,7 +994,8 @@
 
     try:
         optimize = space.sys.get_flag('optimize')
-    except Exception:
+    except RuntimeError:
+        # during bootstrapping
         optimize = 0
     if optimize >= 2:
         code_w.remove_docstrings(space)
@@ -1095,7 +1096,8 @@
     code_w = read_compiled_module(space, cpathname, source)
     try:
         optimize = space.sys.get_flag('optimize')
-    except Exception:
+    except RuntimeError:
+        # during bootstrapping
         optimize = 0
     if optimize >= 2:
         code_w.remove_docstrings(space)
diff --git a/pypy/module/test_lib_pypy/test_os_wait.py b/pypy/module/test_lib_pypy/test_os_wait.py
--- a/pypy/module/test_lib_pypy/test_os_wait.py
+++ b/pypy/module/test_lib_pypy/test_os_wait.py
@@ -1,6 +1,7 @@
-# Generates the resource cache
-#from lib_pypy.ctypes_config_cache import rebuild
-#rebuild.rebuild_one('resource.ctc.py')
+# Generates the resource cache (it might be there already, but maybe not)
+from __future__ import absolute_import
+from lib_pypy.ctypes_config_cache import rebuild
+rebuild.rebuild_one('resource.ctc.py')
 
 import os
 
diff --git a/pypy/objspace/std/test/test_methodcache.py b/pypy/objspace/std/test/test_methodcache.py
--- a/pypy/objspace/std/test/test_methodcache.py
+++ b/pypy/objspace/std/test/test_methodcache.py
@@ -4,7 +4,28 @@
 class AppTestMethodCaching(test_typeobject.AppTestTypeObject):
     spaceconfig = {"objspace.std.withmethodcachecounter": True}
 
+    def setup_class(cls):
+        # This is for the following tests, which are a bit fragile and
+        # historically have been failing once in a while.  With this hack,
+        # they are run up to 5 times in a row, saving the frame of the
+        # failed attempt.  This means occasional collisions should work
+        # differently during the retry.
+        cls.w_retry = cls.space.appexec([], """():
+            def retry(run):
+                keepalive = []
+                for i in range(4):
+                    try:
+                        return run()
+                    except AssertionError:
+                        import sys
+                        keepalive.append(sys.exc_info())
+                return run()
+            return retry
+        """)
+
     def test_mix_classes(self):
+      @self.retry
+      def run():
         import __pypy__
         class A(object):
             def f(self):
@@ -32,6 +53,8 @@
         # calling space.str_w, which .encode('ascii') the string, thus
         # creating new strings all the time. The problem should be solved when
         # we implement proper unicode identifiers in py3k
+      @self.retry
+      def run():
         import __pypy__
         class A(object):
             def f(self):
@@ -70,6 +93,8 @@
         assert cache_counter == (17, 3)
 
     def test_subclasses(self):
+      @self.retry
+      def run():
         import __pypy__
         class A(object):
             def f(self):
@@ -89,6 +114,8 @@
         assert sum(cache_counter) == 30
   
     def test_many_names(self):
+      @self.retry
+      def run():
         import __pypy__
         laste = None
         for j in range(20):
@@ -143,6 +170,8 @@
         assert e.foo == 3
 
     def test_custom_metaclass(self):
+      @self.retry
+      def run():
         import __pypy__
         for j in range(20):
             class MetaA(type):
@@ -164,6 +193,8 @@
             raise AssertionError("cache_counter = %r" % (cache_counter,))
 
     def test_mutate_class(self):
+      @self.retry
+      def run():
         import __pypy__
         class A(object):
             x = 1
diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -1918,9 +1918,10 @@
             res = self.execute_operation(rop.CAST_INT_TO_FLOAT,
                                          [BoxInt(x)],  'float').value
             assert longlong.getrealfloat(res) == float(x)
-            res = self.execute_operation(rop.CAST_INT_TO_FLOAT,
-                                         [ConstInt(x)],  'float').value
-            assert longlong.getrealfloat(res) == float(x)
+            # --- the front-end never generates CAST_INT_TO_FLOAT(Const)
+            #res = self.execute_operation(rop.CAST_INT_TO_FLOAT,
+            #                             [ConstInt(x)],  'float').value
+            #assert longlong.getrealfloat(res) == float(x)
 
     def test_cast_float_to_int(self):
         if not self.cpu.supports_floats:
@@ -1930,9 +1931,10 @@
             res = self.execute_operation(rop.CAST_FLOAT_TO_INT,
                                          [BoxFloat(v)],  'int').value
             assert res == int(x)
-            res = self.execute_operation(rop.CAST_FLOAT_TO_INT,
-                                         [ConstFloat(v)],  'int').value
-            assert res == int(x)
+            # --- the front-end never generates CAST_FLOAT_TO_INT(Const)
+            #res = self.execute_operation(rop.CAST_FLOAT_TO_INT,
+            #                             [ConstFloat(v)],  'int').value
+            #assert res == int(x)
 
     def test_convert_float_bytes(self):
         if not self.cpu.supports_floats:
diff --git a/rpython/rlib/cache.py b/rpython/rlib/cache.py
--- a/rpython/rlib/cache.py
+++ b/rpython/rlib/cache.py
@@ -44,8 +44,8 @@
                 return self.content[key]
             except KeyError:
                 if key in self._building:
-                    raise Exception, "%s recursive building of %r" % (
-                        self, key)
+                    raise RuntimeError("%s recursive building of %r" %
+                                       (self, key))
                 self._building[key] = True
                 try:
                     result = self._build(key)


More information about the pypy-commit mailing list