diff options
author | Kumar Aditya <kumaraditya@python.org> | 2024-11-29 16:14:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-29 16:14:20 (GMT) |
commit | 45c5cba318a19dda3ee6f9fc84781cc7a2fbde80 (patch) | |
tree | 756ee66eeb1babba1569682f63d0570005157f28 /Lib | |
parent | b14fdadc6c620875a20b7ccc3c9b069e85d8557a (diff) | |
download | cpython-45c5cba318a19dda3ee6f9fc84781cc7a2fbde80.zip cpython-45c5cba318a19dda3ee6f9fc84781cc7a2fbde80.tar.gz cpython-45c5cba318a19dda3ee6f9fc84781cc7a2fbde80.tar.bz2 |
gh-127316: fix incorrect assertion in setting `__class__` in free-threading (#127399)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_free_threading/test_type.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_free_threading/test_type.py b/Lib/test/test_free_threading/test_type.py index 51463b6..53f6d77 100644 --- a/Lib/test/test_free_threading/test_type.py +++ b/Lib/test/test_free_threading/test_type.py @@ -124,6 +124,21 @@ class TestType(TestCase): for thread in threads: thread.join() + def test_object_class_change(self): + class Base: + def __init__(self): + self.attr = 123 + class ClassA(Base): + pass + class ClassB(Base): + pass + + obj = ClassA() + # keep reference to __dict__ + d = obj.__dict__ + obj.__class__ = ClassB + + def run_one(self, writer_func, reader_func): writer = Thread(target=writer_func) readers = [] |