mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
only accept AttributeError as indicating no __prepare__ attribute on a metaclass, allowing lookup errors to propogate
This commit is contained in:
parent
8de42e2d50
commit
23e018ab98
3 changed files with 26 additions and 2 deletions
|
@ -230,6 +230,20 @@ Make sure it works with subclassing.
|
|||
42
|
||||
>>>
|
||||
|
||||
Test failures in looking up the __prepare__ method work.
|
||||
>>> class ObscureException(Exception):
|
||||
... pass
|
||||
>>> class FailDescr:
|
||||
... def __get__(self, instance, owner):
|
||||
... raise ObscureException
|
||||
>>> class Meta(type):
|
||||
... __prepare__ = FailDescr()
|
||||
>>> class X(metaclass=Meta):
|
||||
... pass
|
||||
Traceback (most recent call last):
|
||||
[...]
|
||||
test.test_metaclass.ObscureException
|
||||
|
||||
"""
|
||||
|
||||
__test__ = {'doctests' : doctests}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue