Author: Armin Rigo <ar...@tunes.org> Branch: py3k Changeset: r86625:0d0c1fea2c5b Date: 2016-08-27 22:13 +0200 http://bitbucket.org/pypy/pypy/changeset/0d0c1fea2c5b/
Log: hg merge default 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"]) -@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)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit