Skip to content
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

asyncio: PendingDeprecationWarning -> DeprecationWarning #12494

Merged
merged 1 commit into from
Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions Lib/asyncio/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def current_task(cls, loop=None):
"""
warnings.warn("Task.current_task() is deprecated, "
"use asyncio.current_task() instead",
PendingDeprecationWarning,
DeprecationWarning,
stacklevel=2)
if loop is None:
loop = events.get_event_loop()
Expand All @@ -111,7 +111,7 @@ def all_tasks(cls, loop=None):
"""
warnings.warn("Task.all_tasks() is deprecated, "
"use asyncio.all_tasks() instead",
PendingDeprecationWarning,
DeprecationWarning,
stacklevel=2)
return _all_tasks_compat(loop)

Expand Down
18 changes: 9 additions & 9 deletions Lib/test/test_asyncio/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1634,26 +1634,26 @@ def coro():
def test_current_task_deprecated(self):
Task = self.__class__.Task

with self.assertWarns(PendingDeprecationWarning):
with self.assertWarns(DeprecationWarning):
self.assertIsNone(Task.current_task(loop=self.loop))

async def coro(loop):
with self.assertWarns(PendingDeprecationWarning):
with self.assertWarns(DeprecationWarning):
self.assertIs(Task.current_task(loop=loop), task)

# See http://bugs.python.org/issue29271 for details:
asyncio.set_event_loop(loop)
try:
with self.assertWarns(PendingDeprecationWarning):
with self.assertWarns(DeprecationWarning):
self.assertIs(Task.current_task(None), task)
with self.assertWarns(PendingDeprecationWarning):
with self.assertWarns(DeprecationWarning):
self.assertIs(Task.current_task(), task)
finally:
asyncio.set_event_loop(None)

task = self.new_task(self.loop, coro(self.loop))
self.loop.run_until_complete(task)
with self.assertWarns(PendingDeprecationWarning):
with self.assertWarns(DeprecationWarning):
self.assertIsNone(Task.current_task(loop=self.loop))

def test_current_task(self):
Expand Down Expand Up @@ -1982,7 +1982,7 @@ def test_all_tasks_deprecated(self):
Task = self.__class__.Task

async def coro():
with self.assertWarns(PendingDeprecationWarning):
with self.assertWarns(DeprecationWarning):
assert Task.all_tasks(self.loop) == {t}

t = self.new_task(self.loop, coro())
Expand Down Expand Up @@ -2012,9 +2012,9 @@ def kill_me(loop):
# See http://bugs.python.org/issue29271 for details:
asyncio.set_event_loop(self.loop)
try:
with self.assertWarns(PendingDeprecationWarning):
with self.assertWarns(DeprecationWarning):
self.assertEqual(Task.all_tasks(), {task})
with self.assertWarns(PendingDeprecationWarning):
with self.assertWarns(DeprecationWarning):
self.assertEqual(Task.all_tasks(None), {task})
finally:
asyncio.set_event_loop(None)
Expand Down Expand Up @@ -2692,7 +2692,7 @@ def done(self):
self.assertEqual(asyncio.all_tasks(loop), set())
self._register_task(task)
self.assertEqual(asyncio.all_tasks(loop), set())
with self.assertWarns(PendingDeprecationWarning):
with self.assertWarns(DeprecationWarning):
self.assertEqual(asyncio.Task.all_tasks(loop), {task})
self._unregister_task(task)

Expand Down
4 changes: 2 additions & 2 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2088,7 +2088,7 @@ _asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop)
PyObject *ret;
PyObject *current_task_func;

if (PyErr_WarnEx(PyExc_PendingDeprecationWarning,
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"Task.current_task() is deprecated, " \
"use asyncio.current_task() instead",
1) < 0) {
Expand Down Expand Up @@ -2136,7 +2136,7 @@ _asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop)
PyObject *res;
PyObject *all_tasks_func;

if (PyErr_WarnEx(PyExc_PendingDeprecationWarning,
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"Task.all_tasks() is deprecated, " \
"use asyncio.all_tasks() instead",
1) < 0) {
Expand Down