Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc0c9c2

Browse files
gh-133454: Reduce the number of threads in test_racing_getbuf_and_releasebuf (GH-133458)
The original reproducer only used 10 threads.
1 parent71dea74 commitfc0c9c2

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

‎Lib/test/test_memoryview.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -743,19 +743,21 @@ def test_racing_getbuf_and_releasebuf(self):
743743
frommultiprocessing.managersimportSharedMemoryManager
744744
exceptImportError:
745745
self.skipTest("Test requires multiprocessing")
746-
fromthreadingimportThread
746+
fromthreadingimportThread,Event
747747

748-
n=100
748+
start=Event()
749749
withSharedMemoryManager()assmm:
750750
obj=smm.ShareableList(range(100))
751-
threads= []
752-
for_inrange(n):
753-
# Issue gh-127085, the `ShareableList.count` is just a convenient way to mess the `exports`
754-
# counter of `memoryview`, this issue has no direct relation with `ShareableList`.
755-
threads.append(Thread(target=obj.count,args=(1,)))
756-
751+
deftest():
752+
# Issue gh-127085, the `ShareableList.count` is just a
753+
# convenient way to mess the `exports` counter of `memoryview`,
754+
# this issue has no direct relation with `ShareableList`.
755+
start.wait(support.SHORT_TIMEOUT)
756+
foriinrange(10):
757+
obj.count(1)
758+
threads= [Thread(target=test)for_inrange(10)]
757759
withthreading_helper.start_threads(threads):
758-
pass
760+
start.set()
759761

760762
delobj
761763

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp