Skip to content

Commit 6d98098

Browse files
committed
gh-154871: Address review comments
1 parent 7891d3e commit 6d98098

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

Lib/test/test_asyncio/test_tasks.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,8 +2924,14 @@ async def coro():
29242924
with self.assertRaises(AttributeError):
29252925
del task._log_destroy_pending
29262926

2927-
def test_get_context_uninitialized(self):
2928-
task = self.Task.__new__(self.Task)
2927+
def test_get_context_uninitialized_segfault(self):
2928+
# https://github.com/python/cpython/issues/154871
2929+
2930+
class UninitializedTask(self.Task):
2931+
def __init__(self, *args, **kwargs):
2932+
pass
2933+
2934+
task = UninitializedTask()
29292935
self.assertIsNone(task.get_context())
29302936

29312937

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
Fixed a crash in ``_asyncio.Task.get_context()`` when called on an
2-
uninitialized task. The method now returns ``None`` instead of crashing
3-
the interpreter.
1+
Fixed a crash in :meth:`asyncio.Task.get_context`
2+
when called on an uninitialized task.

0 commit comments

Comments
 (0)