FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.14] gh-133454: Reduce the number of threads in test_racing_getbuf_and_releasebuf (GH-133458) by miss-islington · Pull Request #134589 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
20 changes: 11 additions & 9 deletions Lib/test/test_memoryview.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -743,19 +743,21 @@ def test_racing_getbuf_and_releasebuf(self):
from multiprocessing.managers import SharedMemoryManager
except ImportError:
self.skipTest("Test requires multiprocessing")
from threading import Thread
from threading import Thread, Event

n = 100
start = Event()
with SharedMemoryManager() as smm:
obj = smm.ShareableList(range(100))
threads = []
for _ in range(n):
# Issue gh-127085, the `ShareableList.count` is just a convenient way to mess the `exports`
# counter of `memoryview`, this issue has no direct relation with `ShareableList`.
threads.append(Thread(target=obj.count, args=(1,)))

def test():
# Issue gh-127085, the `ShareableList.count` is just a
# convenient way to mess the `exports` counter of `memoryview`,
# this issue has no direct relation with `ShareableList`.
start.wait(support.SHORT_TIMEOUT)
for i in range(10):
obj.count(1)
threads = [Thread(target=test) for _ in range(10)]
with threading_helper.start_threads(threads):
pass
start.set()

del obj

Expand Down

Back | FazBrowse Home | New Git URL