Author: Ronan Lamy <ronan.l...@gmail.com> Branch: py3.5 Changeset: r92433:a42b82e1eb73 Date: 2017-09-21 19:32 +0100 http://bitbucket.org/pypy/pypy/changeset/a42b82e1eb73/
Log: hg merge default diff --git a/lib-python/2.7/multiprocessing/heap.py b/lib-python/2.7/multiprocessing/heap.py --- a/lib-python/2.7/multiprocessing/heap.py +++ b/lib-python/2.7/multiprocessing/heap.py @@ -62,7 +62,7 @@ self.size = size self.name = 'pym-%d-%d' % (os.getpid(), Arena._counter.next()) self.buffer = mmap.mmap(-1, self.size, tagname=self.name) - assert win32.GetLastError() == 0, 'tagname already in use' + #assert win32.GetLastError() == 0, 'tagname already in use' self._state = (self.size, self.name) def __getstate__(self): @@ -72,7 +72,7 @@ def __setstate__(self, state): self.size, self.name = self._state = state self.buffer = mmap.mmap(-1, self.size, tagname=self.name) - assert win32.GetLastError() == win32.ERROR_ALREADY_EXISTS + #assert win32.GetLastError() == win32.ERROR_ALREADY_EXISTS else: diff --git a/lib-python/2.7/string.py b/lib-python/2.7/string.py --- a/lib-python/2.7/string.py +++ b/lib-python/2.7/string.py @@ -75,7 +75,7 @@ for i in range(256): buf[i] = i for i in range(n): - buf[ord(fromstr[i])] = tostr[i] + buf[ord(fromstr[i])] = ord(tostr[i]) return str(buf) diff --git a/pypy/doc/windows.rst b/pypy/doc/windows.rst --- a/pypy/doc/windows.rst +++ b/pypy/doc/windows.rst @@ -120,7 +120,7 @@ Download the versions of all the external packages from https://bitbucket.org/pypy/pypy/downloads/local_59.zip (for post-5.8 builds) with sha256 checksum -``0f96c045db1f5f73ad0fae7857caa69c261324bd8e51f6d2ad1fa842c4a5f26f`` +``6344230e90ab7a9cb84efbae1ba22051cdeeb40a31823e0808545b705aba8911`` https://bitbucket.org/pypy/pypy/downloads/local_5.8.zip (to reproduce 5.8 builds) with sha256 checksum ``fbe769bf3a4ab6f5a8b0a05b61930fc7f37da2a9a85a8f609cf5a9bad06e2554`` or diff --git a/pypy/interpreter/test/test_typedef.py b/pypy/interpreter/test/test_typedef.py --- a/pypy/interpreter/test/test_typedef.py +++ b/pypy/interpreter/test/test_typedef.py @@ -419,3 +419,7 @@ def f(): return x assert f.__closure__[0].cell_contents is x + + def test_get_with_none_arg(self): + raises(TypeError, type.__dict__['__mro__'].__get__, None) + raises(TypeError, type.__dict__['__mro__'].__get__, None, None) diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py --- a/pypy/interpreter/typedef.py +++ b/pypy/interpreter/typedef.py @@ -300,6 +300,8 @@ if (space.is_w(w_obj, space.w_None) and not space.is_w(w_cls, space.type(space.w_None))): #print self, w_obj, w_cls + if space.is_w(w_cls, space.w_None): + raise oefmt(space.w_TypeError, "__get__(None, None) is invalid") return self else: try: diff --git a/pypy/module/_multiprocessing/interp_win32.py b/pypy/module/_multiprocessing/interp_win32.py --- a/pypy/module/_multiprocessing/interp_win32.py +++ b/pypy/module/_multiprocessing/interp_win32.py @@ -111,6 +111,7 @@ raise wrap_oserror(space, rwin32.lastSavedWindowsError()) def GetLastError(space): + """NOTE: don't use this. See issue #2658""" return space.newint(rwin32.GetLastError_saved()) # __________________________________________________________ diff --git a/pypy/module/_vmprof/__init__.py b/pypy/module/_vmprof/__init__.py --- a/pypy/module/_vmprof/__init__.py +++ b/pypy/module/_vmprof/__init__.py @@ -1,5 +1,7 @@ from pypy.interpreter.mixedmodule import MixedModule from rpython.rlib.rvmprof import VMProfPlatformUnsupported +from rpython.translator.platform import CompilationError + class Module(MixedModule): """ @@ -29,3 +31,9 @@ import pypy.module._vmprof.interp_vmprof except VMProfPlatformUnsupported as e: pass +except CompilationError as e: + import sys + if sys.platform == 'win32': + pass + else: + raise diff --git a/pypy/module/_vmprof/conftest.py b/pypy/module/_vmprof/conftest.py --- a/pypy/module/_vmprof/conftest.py +++ b/pypy/module/_vmprof/conftest.py @@ -1,6 +1,8 @@ -import py, platform +import py, platform, sys def pytest_collect_directory(path, parent): if platform.machine() == 's390x': - py.test.skip("zarch tests skipped") + py.test.skip("_vmprof tests skipped") + if sys.platform == 'win32': + py.test.skip("_vmprof tests skipped") pytest_collect_file = pytest_collect_directory diff --git a/pypy/module/cpyext/methodobject.py b/pypy/module/cpyext/methodobject.py --- a/pypy/module/cpyext/methodobject.py +++ b/pypy/module/cpyext/methodobject.py @@ -102,21 +102,27 @@ return self.space.unwrap(self.descr_method_repr()) def descr_method_repr(self): + w_objclass = self.w_objclass + assert isinstance(w_objclass, W_TypeObject) return self.space.newtext("<method '%s' of '%s' objects>" % ( - self.name, self.w_objclass.getname(self.space).encode('utf-8'))) + self.name, w_objclass.name)) def descr_call(self, space, __args__): args_w, kw_w = __args__.unpack() if len(args_w) < 1: + w_objclass = self.w_objclass + assert isinstance(w_objclass, W_TypeObject) raise oefmt(space.w_TypeError, - "descriptor '%8' of '%N' object needs an argument", - self.name, self.w_objclass) + "descriptor '%8' of '%s' object needs an argument", + self.name, w_objclass.name) w_instance = args_w[0] # XXX: needs a stricter test if not space.isinstance_w(w_instance, self.w_objclass): + w_objclass = self.w_objclass + assert isinstance(w_objclass, W_TypeObject) raise oefmt(space.w_TypeError, - "descriptor '%8' requires a '%N' object but received a '%T'", - self.name, self.w_objclass, w_instance) + "descriptor '%8' requires a '%s' object but received a '%T'", + self.name, w_objclass.name, w_instance) w_args = space.newtuple(args_w[1:]) w_kw = space.newdict() for key, w_obj in kw_w.items(): diff --git a/pypy/module/cpyext/test/test_eval.py b/pypy/module/cpyext/test/test_eval.py --- a/pypy/module/cpyext/test/test_eval.py +++ b/pypy/module/cpyext/test/test_eval.py @@ -352,7 +352,7 @@ int recurse(void); res = 0; oldlimit = Py_GetRecursionLimit(); - Py_SetRecursionLimit(200); + Py_SetRecursionLimit(oldlimit/100); res = recurse(); Py_SetRecursionLimit(oldlimit); if (PyErr_Occurred()) diff --git a/pypy/module/sys/__init__.py b/pypy/module/sys/__init__.py --- a/pypy/module/sys/__init__.py +++ b/pypy/module/sys/__init__.py @@ -92,8 +92,6 @@ 'int_info' : 'system.get_int_info(space)', 'hash_info' : 'system.get_hash_info(space)', 'float_repr_style' : 'system.get_float_repr_style(space)', - 'getdlopenflags' : 'system.getdlopenflags', - 'setdlopenflags' : 'system.setdlopenflags', 'get_coroutine_wrapper' : 'vm.get_coroutine_wrapper', 'set_coroutine_wrapper' : 'vm.set_coroutine_wrapper', @@ -104,6 +102,9 @@ if sys.platform == 'win32': interpleveldefs['winver'] = 'version.get_winver(space)' interpleveldefs['getwindowsversion'] = 'vm.getwindowsversion' + else: + interpleveldefs['getdlopenflags'] = 'system.getdlopenflags' + interpleveldefs['setdlopenflags'] = 'system.setdlopenflags' appleveldefs = { 'excepthook' : 'app.excepthook', diff --git a/pypy/module/sys/test/test_sysmodule.py b/pypy/module/sys/test/test_sysmodule.py --- a/pypy/module/sys/test/test_sysmodule.py +++ b/pypy/module/sys/test/test_sysmodule.py @@ -492,6 +492,8 @@ def test_dlopenflags(self): import sys + if not hasattr(sys, "getdlopenflags"): + skip('{gs}etdlopenflags is not implemented on this platform') raises(TypeError, sys.getdlopenflags, 42) oldflags = sys.getdlopenflags() raises(TypeError, sys.setdlopenflags) diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py @@ -2456,9 +2456,18 @@ pt = lib.call2(lib.cb2) assert (pt.x, pt.y) == (99*500*999, -99*500*999) +def _only_test_on_linux_intel(): + if not sys.platform.startswith('linux'): + py.test.skip('only running the memory-intensive test on Linux') + import platform + machine = platform.machine() + if 'x86' not in machine and 'x64' not in machine: + py.test.skip('only running the memory-intensive test on x86/x64') + def test_ffi_gc_size_arg(): # with PyPy's GC, these calls to ffi.gc() would rapidly consume # 40 GB of RAM without the third argument + _only_test_on_linux_intel() ffi = FFI() ffi.cdef("void *malloc(size_t); void free(void *);") lib = ffi.verify(r""" @@ -2467,8 +2476,8 @@ for i in range(2000): p = lib.malloc(20*1024*1024) # 20 MB p1 = ffi.cast("char *", p) - for j in xrange(0, 20*1024*1024, 4096): - p1[j] = '!' + for j in range(0, 20*1024*1024, 4096): + p1[j] = b'!' p = ffi.gc(p, lib.free, 20*1024*1024) del p @@ -2478,6 +2487,7 @@ # is skipped on CPython, where it eats all the memory. if '__pypy__' not in sys.builtin_module_names: py.test.skip("find a way to tweak the cyclic GC of CPython") + _only_test_on_linux_intel() ffi = FFI() ffi.cdef("void *malloc(size_t); void free(void *);") lib = ffi.verify(r""" diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_version.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_version.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_version.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_version.py @@ -37,7 +37,7 @@ v = cffi.__version__.replace('+', '') p = os.path.join(parent, 'doc', 'source', 'installation.rst') content = open(p).read() - assert ("cffi/cffi-%s.tar.gz" % v) in content + assert ("/cffi-%s.tar.gz" % v) in content def test_setup_version(): parent = os.path.dirname(os.path.dirname(cffi.__file__)) diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py @@ -1,7 +1,7 @@ # Generated by pypy/tool/import_cffi.py import sys, os, py -from cffi import FFI, VerificationError, FFIError +from cffi import FFI, VerificationError, FFIError, CDefError from cffi import recompiler from pypy.module.test_lib_pypy.cffi_tests.udir import udir from pypy.module.test_lib_pypy.cffi_tests.support import u, long @@ -1127,7 +1127,9 @@ def test_some_float_invalid_1(): ffi = FFI() - py.test.raises(FFIError, ffi.cdef, "typedef long double... foo_t;") + py.test.raises((FFIError, # with pycparser <= 2.17 + CDefError), # with pycparser >= 2.18 + ffi.cdef, "typedef long double... foo_t;") def test_some_float_invalid_2(): ffi = FFI() diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py @@ -1,6 +1,7 @@ # Generated by pypy/tool/import_cffi.py import os, sys, math, py from cffi import FFI, FFIError, VerificationError, VerificationMissing, model +from cffi import CDefError from cffi import recompiler from pypy.module.test_lib_pypy.cffi_tests.support import * import _cffi_backend @@ -2223,7 +2224,9 @@ def test_unsupported_some_primitive_types(): ffi = FFI() - py.test.raises(FFIError, ffi.cdef, """typedef void... foo_t;""") + py.test.raises((FFIError, # with pycparser <= 2.17 + CDefError), # with pycparser >= 2.18 + ffi.cdef, """typedef void... foo_t;""") # ffi.cdef("typedef int... foo_t;") py.test.raises(VerificationError, ffi.verify, "typedef float foo_t;") @@ -2292,7 +2295,16 @@ assert ffi.typeof("UINT_PTR") is ffi.typeof(expected) assert ffi.typeof("PTSTR") is ffi.typeof("wchar_t *") -def test_gc_pypy_size_arg(): +def _only_test_on_linux_intel(): + if not sys.platform.startswith('linux'): + py.test.skip('only running the memory-intensive test on Linux') + import platform + machine = platform.machine() + if 'x86' not in machine and 'x64' not in machine: + py.test.skip('only running the memory-intensive test on x86/x64') + +def test_ffi_gc_size_arg(): + _only_test_on_linux_intel() ffi = FFI() ffi.cdef("void *malloc(size_t); void free(void *);") lib = ffi.verify(r""" @@ -2301,8 +2313,8 @@ for i in range(2000): p = lib.malloc(20*1024*1024) # 20 MB p1 = ffi.cast("char *", p) - for j in xrange(0, 20*1024*1024, 4096): - p1[j] = '!' + for j in range(0, 20*1024*1024, 4096): + p1[j] = b'!' p = ffi.gc(p, lib.free, 20*1024*1024) del p # with PyPy's GC, the above would rapidly consume 40 GB of RAM @@ -2314,6 +2326,7 @@ # is skipped on CPython, where it eats all the memory. if '__pypy__' not in sys.builtin_module_names: py.test.skip("find a way to tweak the cyclic GC of CPython") + _only_test_on_linux_intel() ffi = FFI() ffi.cdef("void *malloc(size_t); void free(void *);") lib = ffi.verify(r""" diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py --- a/rpython/rlib/ropenssl.py +++ b/rpython/rlib/ropenssl.py @@ -473,6 +473,7 @@ ssl_external('sk_ACCESS_DESCRIPTION_value', [AUTHORITY_INFO_ACCESS, rffi.INT], ACCESS_DESCRIPTION, macro=True) ssl_external('AUTHORITY_INFO_ACCESS_free', [AUTHORITY_INFO_ACCESS], lltype.Void) +ssl_external('CRL_DIST_POINTS_free', [stack_st_DIST_POINT], lltype.Void) ssl_external('GENERAL_NAME_print', [BIO, GENERAL_NAME], rffi.INT) ssl_external('pypy_GENERAL_NAME_dirn', [GENERAL_NAME], X509_NAME, _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit