[pypy-commit] pypy py3.7: merge py3.6
cfbolz
pypy.commits at gmail.com
Tue Jan 7 07:39:43 EST 2020
Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: py3.7
Changeset: r98480:fd3749680834
Date: 2020-01-07 12:40 +0100
http://bitbucket.org/pypy/pypy/changeset/fd3749680834/
Log: merge py3.6
diff --git a/pypy/interpreter/test/test_class.py b/pypy/interpreter/test/test_class.py
--- a/pypy/interpreter/test/test_class.py
+++ b/pypy/interpreter/test/test_class.py
@@ -140,3 +140,9 @@
"metaclass found to be 'function', but calling <class 'function'> "
"with args ('Foo', (<function test_nonsensical_base_error_message"
".<locals>.foo_func at ")
+
+ with raises(TypeError) as exc:
+ class Foo(object, object):
+ pass
+ assert str(exc.value).startswith(
+ "duplicate base class 'object'")
diff --git a/pypy/module/__builtin__/compiling.py b/pypy/module/__builtin__/compiling.py
--- a/pypy/module/__builtin__/compiling.py
+++ b/pypy/module/__builtin__/compiling.py
@@ -177,7 +177,8 @@
# give a more comprehensible error message for TypeErrors
if e.got_any_traceback():
raise
- if not e.match(space, space.w_TypeError):
+ if (not e.match(space, space.w_TypeError) or
+ space.is_w(w_meta, space.w_type)):
raise
raise oefmt(space.w_TypeError,
"metaclass found to be '%N', but calling %R "
diff --git a/pypy/module/_cffi_backend/misc.py b/pypy/module/_cffi_backend/misc.py
--- a/pypy/module/_cffi_backend/misc.py
+++ b/pypy/module/_cffi_backend/misc.py
@@ -8,7 +8,7 @@
from rpython.rlib.objectmodel import specialize, we_are_translated
from rpython.rlib.rarithmetic import r_uint, r_ulonglong
from rpython.rlib.unroll import unrolling_iterable
-from rpython.rlib.rdynload import dlopen, DLOpenError
+from rpython.rlib.rdynload import dlopen, DLOpenError, DLLHANDLE
from rpython.rlib.nonconst import NonConstant
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
from rpython.translator.tool.cbuild import ExternalCompilationInfo
@@ -408,7 +408,26 @@
# ____________________________________________________________
def dlopen_w(space, w_filename, flags):
- if WIN32 and space.isinstance_w(w_filename, space.w_unicode):
+ from pypy.module._cffi_backend.cdataobj import W_CData
+ from pypy.module._cffi_backend import ctypeptr
+
+ autoclose = True
+ if isinstance(w_filename, W_CData):
+ # 'flags' ignored in this case
+ w_ctype = w_filename.ctype
+ if (not isinstance(w_ctype, ctypeptr.W_CTypePointer) or
+ not w_ctype.is_void_ptr):
+ raise oefmt(space.w_TypeError,
+ "dlopen() takes a file name or 'void *' handle, not '%s'",
+ w_ctype.name)
+ handle = w_filename.unsafe_escaping_ptr()
+ if not handle:
+ raise oefmt(space.w_RuntimeError, "cannot call dlopen(NULL)")
+ fname = w_ctype.extra_repr(handle)
+ handle = rffi.cast(DLLHANDLE, handle)
+ autoclose = False
+ #
+ elif WIN32 and space.isinstance_w(w_filename, space.w_unicode):
fname = space.text_w(space.repr(w_filename))
utf8_name = space.utf8_w(w_filename)
uni_len = space.len_w(w_filename)
@@ -429,4 +448,4 @@
handle = dlopen(ll_libname, flags)
except DLOpenError as e:
raise wrap_dlopenerror(space, e, fname)
- return fname, handle
+ return fname, handle, autoclose
More information about the pypy-commit
mailing list