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

arigo pypy.commits at gmail.com
Sat Aug 27 16:14:30 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r86626:6833b14f183f
Date: 2016-08-27 22:13 +0200
http://bitbucket.org/pypy/pypy/changeset/6833b14f183f/

Log:	hg merge py3k

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -983,7 +983,7 @@
                                   lltype.Void, compilation_info=eci)
     def reinit_tls(space):
         _reinit_tls()
-    add_fork_hook('child', _reinit_tls)
+    add_fork_hook('child', reinit_tls)
 
 def init_function(func):
     INIT_FUNCTIONS.append(func)
diff --git a/pypy/module/cpyext/test/buffer_test.c b/pypy/module/cpyext/test/buffer_test.c
--- a/pypy/module/cpyext/test/buffer_test.c
+++ b/pypy/module/cpyext/test/buffer_test.c
@@ -198,7 +198,7 @@
     "buffer_test",
     "Module Doc",
     -1,
-    buffer_functions;
+    buffer_functions,
     NULL,
     NULL,
     NULL,
diff --git a/pypy/module/cpyext/test/test_memoryobject.py b/pypy/module/cpyext/test/test_memoryobject.py
--- a/pypy/module/cpyext/test/test_memoryobject.py
+++ b/pypy/module/cpyext/test/test_memoryobject.py
@@ -1,13 +1,8 @@
-import pytest
 from pypy.module.cpyext.test.test_api import BaseApiTest
 from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
 
 class TestMemoryViewObject(BaseApiTest):
     def test_fromobject(self, space, api):
-        if space.is_true(space.lt(space.sys.get('version_info'),
-                                  space.wrap((2, 7)))):
-            py.test.skip("unsupported before Python 2.7")
-
         w_hello = space.newbytes("hello")
         assert api.PyObject_CheckBuffer(w_hello)
         w_view = api.PyMemoryView_FromObject(w_hello)
diff --git a/pypy/objspace/std/test/test_random_attr.py b/pypy/objspace/std/test/test_random_attr.py
--- a/pypy/objspace/std/test/test_random_attr.py
+++ b/pypy/objspace/std/test/test_random_attr.py
@@ -1,6 +1,5 @@
 import pytest
 import sys
-from pypy.tool.pytest.objspace import gettestobjspace
 try:
     import __pypy__
 except ImportError:
@@ -23,22 +22,23 @@
 
 attrnames = strategies.sampled_from(["a", "b", "c"])
 
- at strategies.composite
-def class_attr(draw):
-    what = draw(strategies.sampled_from(["value", "method", "property"]))
-    if what == "value":
-        val = draw(strategies.integers())
-        return val, str(val)
-    if what == "method":
-        val = draw(strategies.integers())
-        return (lambda self, val=val: val,
-                "lambda self: %d" % val)
-    if what == "property":
-        val = draw(strategies.integers())
-        return (property(lambda self, val=val: val,
-                            lambda self, val: None,
-                            lambda self: None),
-                "property(lambda self: %d, lambda self, val: None, lambda self: None)" % val)
+def make_value_attr(val):
+    return val, str(val)
+
+def make_method(val):
+    return (lambda self, val=val: val,
+            "lambda self: %d" % val)
+
+def make_property(val):
+    return (
+        property(lambda self: val, lambda self, val: None, lambda self: None),
+        "property(lambda self: %d, lambda self, val: None, lambda self: None)" % val)
+
+value_attrs = strategies.builds(make_value_attr, strategies.integers())
+methods = strategies.builds(make_method, strategies.integers())
+properties = strategies.builds(make_property, strategies.integers())
+class_attrs = strategies.one_of(value_attrs, methods, properties)
+
 
 @strategies.composite
 def make_code(draw):
@@ -55,7 +55,7 @@
     for name in ["a", "b", "c"]:
         if not draw(strategies.booleans()):
             continue
-        dct[name], codeval = draw(class_attr())
+        dct[name], codeval = draw(class_attrs)
         code.append("    %s = %s" % (name, codeval))
     class OldBase: pass
     class NewBase(object): pass
@@ -99,11 +99,11 @@
             else:
                 code.append("a.%s = lambda : %s" % (attr, val))
         elif op == "writeclass":
-            val, codeval = draw(class_attr())
+            val, codeval = draw(class_attrs)
             setattr(cls, attr, val)
             code.append("A.%s = %s" % (attr, codeval))
         elif op == "writebase":
-            val, codeval = draw(class_attr())
+            val, codeval = draw(class_attrs)
             setattr(OldBase, attr, val)
             setattr(NewBase, attr, val)
             code.append("OldBase.%s = NewBase.%s = %s" % (attr, attr , codeval))


More information about the pypy-commit mailing list