mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
gh-127773: Disable attribute cache on incompatible MRO entries (GH-127924)
This commit is contained in:
parent
76ffaef729
commit
aa6579cb60
4 changed files with 50 additions and 2 deletions
|
@ -254,6 +254,33 @@ Test failures in looking up the __prepare__ method work.
|
|||
[...]
|
||||
test.test_metaclass.ObscureException
|
||||
|
||||
Test setting attributes with a non-base type in mro() (gh-127773).
|
||||
|
||||
>>> class Base:
|
||||
... value = 1
|
||||
...
|
||||
>>> class Meta(type):
|
||||
... def mro(cls):
|
||||
... return (cls, Base, object)
|
||||
...
|
||||
>>> class WeirdClass(metaclass=Meta):
|
||||
... pass
|
||||
...
|
||||
>>> Base.value
|
||||
1
|
||||
>>> WeirdClass.value
|
||||
1
|
||||
>>> Base.value = 2
|
||||
>>> Base.value
|
||||
2
|
||||
>>> WeirdClass.value
|
||||
2
|
||||
>>> Base.value = 3
|
||||
>>> Base.value
|
||||
3
|
||||
>>> WeirdClass.value
|
||||
3
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue