mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-133467: Fix typeobject tp_base race in free threading (gh-140549)
This commit is contained in:
parent
986bb0a1a2
commit
b83f379a97
4 changed files with 30 additions and 4 deletions
|
|
@ -141,6 +141,25 @@ def reader():
|
|||
|
||||
self.run_one(writer, reader)
|
||||
|
||||
def test_bases_change(self):
|
||||
class BaseA:
|
||||
pass
|
||||
|
||||
class Derived(BaseA):
|
||||
pass
|
||||
|
||||
def writer():
|
||||
for _ in range(1000):
|
||||
class BaseB:
|
||||
pass
|
||||
Derived.__bases__ = (BaseB,)
|
||||
|
||||
def reader():
|
||||
for _ in range(1000):
|
||||
Derived.__base__
|
||||
|
||||
self.run_one(writer, reader)
|
||||
|
||||
def run_one(self, writer_func, reader_func):
|
||||
barrier = threading.Barrier(NTHREADS)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue