Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: py3.6
Changeset: r98477:f3d88f2b389f
Date: 2020-01-07 11:45 +0100
http://bitbucket.org/pypy/pypy/changeset/f3d88f2b389f/
Log: don't give new error message if metaclass is actually type
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
@@ -155,7 +155,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 "
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit