8000 gh-128002: add more thread safety tests for asyncio by kumaraditya303 · Pull Request #128480 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-128002: add more thread safety tests for asyncio #128480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix test
  • Loading branch information
kumaraditya303 committed Jan 13, 2025
commit 025fd626a12501548e3f8494fa36f372a8afcbac
7 changes: 3 additions & 4 deletions Lib/test/test_asyncio/test_free_threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,9 @@ async def main():
r.run(main())

def test_run_coroutine_threadsafe_exception(self) -> None:
exc = MyException("test")

async def coro():
await asyncio.sleep(0)
raise exc
raise MyException("test")

def in_thread(loop: asyncio.AbstractEventLoop):
fut = asyncio.run_coroutine_threadsafe(coro(), loop)
Expand All @@ -101,7 +99,8 @@ async def main():

self.assertEqual(len(results), 10)
for result in results:
self.assertIs(result, exc)
self.assertIsInstance(result, MyException)
self.assertEqual(str(result), "test")

with asyncio.Runner() as r:
loop = r.get_loop()
Expand Down
Loading
0