diff options
author | Petr Viktorin <encukou@gmail.com> | 2025-01-13 13:10:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-13 13:10:41 (GMT) |
commit | aa6579cb60b4fcd652d7bc83fed2668e4ae84db3 (patch) | |
tree | a13dd24b74abc91daaff3db9c502e1d35bc922f6 /Lib/test/test_metaclass.py | |
parent | 76ffaef729c91bb79da6df2ade48f3ec51118300 (diff) | |
download | cpython-aa6579cb60b4fcd652d7bc83fed2668e4ae84db3.zip cpython-aa6579cb60b4fcd652d7bc83fed2668e4ae84db3.tar.gz cpython-aa6579cb60b4fcd652d7bc83fed2668e4ae84db3.tar.bz2 |
gh-127773: Disable attribute cache on incompatible MRO entries (GH-127924)
Diffstat (limited to 'Lib/test/test_metaclass.py')
-rw-r--r-- | Lib/test/test_metaclass.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_metaclass.py b/Lib/test/test_metaclass.py index b37b7de..07a333f 100644 --- a/Lib/test/test_metaclass.py +++ b/Lib/test/test_metaclass.py @@ -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 |