GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-158194: Exercise type freezing in concurrent setattr deadlock test… · orsenthil/cpython@769222a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Lib/test/test_free_threading
    • test_type.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Lib/test/test_free_threading/test_type.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_free_threading/test_type.py
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ def test_concurrent_setattr_deadlock(self):
375375
# dict mutex and waited for the type lock.
376376
# This is fairly difficult to trigger the race but this N seems to do
377377
# it at least sometimes.
378+
type_freeze = import_helper.import_module("_testlimitedcapi").type_freeze
378379
N = 200
379380
done = False
380381

@@ -401,6 +402,15 @@ def lister():
401402
while not done:
402403
Base.__subclasses__()
403404

405+
def freezer():
406+
# gh-158194: Exercise type freezing concurrently with slot
407+
# updates and competing stop-the-world requests.
408+
barrier.wait()
409+
for _ in range(10):
410+
class Frozen:
411+
pass
412+
type_freeze(Frozen)
413+
404414
def basesetter():
405415
nonlocal done
406416
barrier.wait()
@@ -418,7 +428,7 @@ class B(A):
418428
# to keep the type lock and the stop-the-world mutex contended, which
419429
# is what gets the setters into the window where it happens.
420430
targets = (setter, setter, subclasser, subclasser,
421-
lister, lister, basesetter)
431+
lister, lister, basesetter, freezer)
422432
barrier = threading.Barrier(len(targets))
423433
threads = [Thread(target=target) for target in targets]
424434
with threading_helper.start_threads(threads):

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.