summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorKumar Aditya <kumaraditya@python.org>2024-11-29 16:14:20 (GMT)
committerGitHub <noreply@github.com>2024-11-29 16:14:20 (GMT)
commit45c5cba318a19dda3ee6f9fc84781cc7a2fbde80 (patch)
tree756ee66eeb1babba1569682f63d0570005157f28 /Lib
parentb14fdadc6c620875a20b7ccc3c9b069e85d8557a (diff)
downloadcpython-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.py15
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 = []