Skip to content

Commit 712edf9

Browse files
committed
Add test that using an explicit PyLong as task name does not accidentally trigger the deferred name formatting logic
1 parent 41e9a59 commit 712edf9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/test/test_asyncio/test_tasks.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,18 @@ async def notmuch():
399399
self.loop.run_until_complete(t1)
400400
self.loop.run_until_complete(t2)
401401

402+
def test_task_set_name_pylong(self):
403+
# test that setting the task name to a PyLong explicitly doesn't
404+
# incorrectly trigger the deferred name formatting logic
405+
async def notmuch():
406+
return 123
407+
408+
t = self.new_task(self.loop, notmuch(), name=987654321)
409+
self.assertEqual(t.get_name(), '987654321')
410+
t.set_name(123456789)
411+
self.assertEqual(t.get_name(), '123456789')
412+
self.loop.run_until_complete(t)
413+
402414
def test_task_repr_name_not_str(self):
403415
async def notmuch():
404416
return 123

0 commit comments

Comments
 (0)