Author: Matti Picus <matti.pi...@gmail.com> Branch: release-pypy2.7-5.x Changeset: r90754:b4750d2d0bee Date: 2017-03-19 21:35 +0200 http://bitbucket.org/pypy/pypy/changeset/b4750d2d0bee/
Log: merge default into release diff --git a/lib-python/2.7/sysconfig.py b/lib-python/2.7/sysconfig.py --- a/lib-python/2.7/sysconfig.py +++ b/lib-python/2.7/sysconfig.py @@ -29,8 +29,8 @@ 'pypy': { 'stdlib': '{base}/lib-{implementation_lower}/{py_version_short}', 'platstdlib': '{base}/lib-{implementation_lower}/{py_version_short}', - 'purelib': '{base}/lib-{implementation_lower}/{py_version_short}', - 'platlib': '{base}/lib-{implementation_lower}/{py_version_short}', + 'purelib': '{base}/site-packages', + 'platlib': '{base}/site-packages', 'include': '{base}/include', 'platinclude': '{base}/include', 'scripts': '{base}/bin', diff --git a/pypy/module/thread/os_local.py b/pypy/module/thread/os_local.py --- a/pypy/module/thread/os_local.py +++ b/pypy/module/thread/os_local.py @@ -1,6 +1,7 @@ import weakref from rpython.rlib import jit from pypy.interpreter.baseobjspace import W_Root +from pypy.interpreter.error import oefmt from pypy.interpreter.executioncontext import ExecutionContext from pypy.interpreter.typedef import (TypeDef, interp2app, GetSetProperty, descr_get_dict) @@ -74,18 +75,18 @@ return w_dict def descr_local__new__(space, w_subtype, __args__): + if __args__.arguments_w or __args__.keywords: + w_parent_init, _ = space.lookup_in_type_where(w_subtype, '__init__') + if w_parent_init is space.w_object: + raise oefmt(space.w_TypeError, + "Initialization arguments are not supported") local = space.allocate_instance(Local, w_subtype) Local.__init__(local, space, __args__) return local - def descr_local__init__(self, space): - # No arguments allowed - pass - Local.typedef = TypeDef("thread._local", __doc__ = "Thread-local data", __new__ = interp2app(Local.descr_local__new__.im_func), - __init__ = interp2app(Local.descr_local__init__), __dict__ = GetSetProperty(descr_get_dict, cls=Local), ) diff --git a/pypy/module/thread/test/test_local.py b/pypy/module/thread/test/test_local.py --- a/pypy/module/thread/test/test_local.py +++ b/pypy/module/thread/test/test_local.py @@ -72,6 +72,19 @@ assert seen1 == [1, 2, 3, 4, 5] assert tags == ['???'] + def test_local_init2(self): + import thread + + class A(object): + def __init__(self, n): + assert n == 42 + self.n = n + class X(thread._local, A): + pass + + x = X(42) + assert x.n == 42 + def test_local_setdict(self): import thread x = thread._local() _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit