[pypy-commit] pypy move-apptest-support: hg merge default

amauryfa noreply at buildbot.pypy.org
Mon Nov 5 21:34:20 CET 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: move-apptest-support
Changeset: r58745:47327bda918d
Date: 2012-11-05 21:04 +0100
http://bitbucket.org/pypy/pypy/changeset/47327bda918d/

Log:	hg merge default

diff --git a/pypy/doc/sandbox.rst b/pypy/doc/sandbox.rst
--- a/pypy/doc/sandbox.rst
+++ b/pypy/doc/sandbox.rst
@@ -25,6 +25,13 @@
 this case we also generate systematic run-time checks against buffer
 overflows.
 
+.. warning::
+  
+  The hard work from the PyPy side is done --- you get a fully secure
+  version.  What is only experimental and unpolished is the library to
+  use this sandboxed PyPy from a regular Python interpreter (CPython, or
+  an unsandboxed PyPy).  Contributions welcome.
+
 
 Overview
 --------
diff --git a/pypy/rlib/rbigint.py b/pypy/rlib/rbigint.py
--- a/pypy/rlib/rbigint.py
+++ b/pypy/rlib/rbigint.py
@@ -337,6 +337,11 @@
         if (self.sign != other.sign or
             self.numdigits() != other.numdigits()):
             return False
+        
+        # Fast path.
+        if len(self._digits) == len(other._digits):
+            return self._digits == other._digits
+
         i = 0
         ld = self.numdigits()
         while i < ld:
@@ -840,7 +845,7 @@
 
         while i > 1 and self._digits[i - 1] == NULLDIGIT:
             i -= 1
-        assert i > 0
+        
         if i != self.numdigits():
             self.size = i
         if self.numdigits() == 1 and self._digits[0] == NULLDIGIT:
diff --git a/pypy/rlib/test/test_rbigint.py b/pypy/rlib/test/test_rbigint.py
--- a/pypy/rlib/test/test_rbigint.py
+++ b/pypy/rlib/test/test_rbigint.py
@@ -300,6 +300,13 @@
         assert not f1.eq(f2)
         assert not f1.eq(f3)
 
+    def test_eq_fastpath(self):
+        x = 1234
+        y = 1234
+        f1 = rbigint.fromint(x)
+        f2 = rbigint.fromint(y)
+        assert f1.eq(f2)
+
     def test_lt(self):
         val = [0, 0x111111111111, 0x111111111112, 0x111111111112FFFF]
         for x in gen_signs(val):
diff --git a/pypy/tool/pytest/objspace.py b/pypy/tool/pytest/objspace.py
--- a/pypy/tool/pytest/objspace.py
+++ b/pypy/tool/pytest/objspace.py
@@ -1,4 +1,5 @@
 import py
+import sys
 from pypy.config.config import ConflictConfigError
 from pypy.tool.option import make_config, make_objspace
 from pypy.tool.pytest import appsupport
@@ -48,7 +49,6 @@
 class TinyObjSpace(object):
     """An object space that delegates everything to the hosting Python."""
     def __init__(self, **kwds):
-        import sys
         info = getattr(sys, 'pypy_translation_info', None)
         for key, value in kwds.iteritems():
             if key == 'usemodules':


More information about the pypy-commit mailing list