[pypy-commit] pypy py3.5: hg merge default

arigo pypy.commits at gmail.com
Fri Mar 10 08:04:54 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r90623:2a55aab6ecce
Date: 2017-03-10 14:04 +0100
http://bitbucket.org/pypy/pypy/changeset/2a55aab6ecce/

Log:	hg merge default

diff --git a/pypy/module/__builtin__/test/test_functional.py b/pypy/module/__builtin__/test/test_functional.py
--- a/pypy/module/__builtin__/test/test_functional.py
+++ b/pypy/module/__builtin__/test/test_functional.py
@@ -636,3 +636,33 @@
         assert max([], default=None) == None
         raises(TypeError, max, 1, default=0)
         raises(TypeError, max, default=1)
+
+
+try:
+    from hypothesis import given, strategies, example
+except ImportError:
+    pass
+else:
+    @given(lst=strategies.lists(strategies.integers()))
+    def test_map_hypothesis(space, lst):
+        print lst
+        w_lst = space.appexec([space.wrap(lst[:])], """(lst):
+            def change(n):
+                if n & 3 == 1:
+                    lst.pop(0)
+                elif n & 3 == 2:
+                    lst.append(100)
+                return n * 2
+            return list(map(change, lst))
+        """)
+        expected = []
+        i = 0
+        while i < len(lst):
+            n = lst[i]
+            if n & 3 == 1:
+                lst.pop(0)
+            elif n & 3 == 2:
+                lst.append(100)
+            expected.append(n * 2)
+            i += 1
+        assert space.unwrap(w_lst) == expected
diff --git a/pypy/module/_cffi_backend/allocator.py b/pypy/module/_cffi_backend/allocator.py
--- a/pypy/module/_cffi_backend/allocator.py
+++ b/pypy/module/_cffi_backend/allocator.py
@@ -4,6 +4,7 @@
 from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
 
 from rpython.rtyper.lltypesystem import lltype, rffi
+from rpython.rlib import rgc
 
 
 class W_Allocator(W_Root):
@@ -20,10 +21,12 @@
         if self.w_alloc is None:
             if self.should_clear_after_alloc:
                 ptr = lltype.malloc(rffi.CCHARP.TO, datasize,
-                                    flavor='raw', zero=True)
+                                    flavor='raw', zero=True,
+                                    add_memory_pressure=True)
             else:
                 ptr = lltype.malloc(rffi.CCHARP.TO, datasize,
-                                    flavor='raw', zero=False)
+                                    flavor='raw', zero=False,
+                                    add_memory_pressure=True)
             return cdataobj.W_CDataNewStd(space, ptr, ctype, length)
         else:
             w_raw_cdata = space.call_function(self.w_alloc,
@@ -50,6 +53,7 @@
             if self.w_free is not None:
                 res.w_free = self.w_free
                 res.register_finalizer(space)
+            rgc.add_memory_pressure(datasize)
             return res
 
     @unwrap_spec(w_init=WrappedDefault(None))
diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py
--- a/pypy/module/cpyext/test/test_typeobject.py
+++ b/pypy/module/cpyext/test/test_typeobject.py
@@ -955,6 +955,9 @@
             assert module.size_of_instances(bar) >= size
 
     def test_app_cant_subclass_two_types(self):
+        import sys
+        if sys.version_info < (2, 7, 9):
+            skip("crashes on CPython (2.7.5 crashes, 2.7.9 is ok)")
         module = self.import_module(name='foo')
         try:
             class bar(module.fooType, module.UnicodeSubtype):
diff --git a/rpython/config/translationoption.py b/rpython/config/translationoption.py
--- a/rpython/config/translationoption.py
+++ b/rpython/config/translationoption.py
@@ -25,9 +25,9 @@
 IS_64_BITS = sys.maxint > 2147483647
 
 SUPPORT__THREAD = (    # whether the particular C compiler supports __thread
-    sys.platform.startswith("linux"))     # Linux works
-    # OS/X doesn't work, because we still target 10.5/10.6 and the
-    # minimum required version is 10.7.  Windows doesn't work.  Please
+    sys.platform.startswith("linux") or     # Linux works
+    sys.platform.startswith("darwin"))      # OS/X >= 10.7 works
+    # Windows doesn't work.  Please
     # add other platforms here if it works on them.
 
 MAINDIR = os.path.dirname(os.path.dirname(__file__))
diff --git a/rpython/translator/platform/darwin.py b/rpython/translator/platform/darwin.py
--- a/rpython/translator/platform/darwin.py
+++ b/rpython/translator/platform/darwin.py
@@ -6,10 +6,10 @@
 #
 # Although Intel 32bit is supported since Apple Mac OS X 10.4, (and PPC since, ever)
 # the @rpath handling used in Darwin._args_for_shared is only availabe
-# since 10.5, so we use that as minimum requirement. Bumped to 10.6
-# because 10.11 does not ship with 10.5 versions of libs
+# since 10.5, so we use that as minimum requirement. Bumped to 10.7
+# to allow the use of thread-local in __thread in C.
 #
-DARWIN_VERSION_MIN = '-mmacosx-version-min=10.6'
+DARWIN_VERSION_MIN = '-mmacosx-version-min=10.7'
 
 class Darwin(posix.BasePosix):
     name = "darwin"


More information about the pypy-commit mailing list