From: Dmitry Shachnev <mitya57@debian.org>
Date: Sat, 7 Dec 2024 22:45:07 +0300
Subject: Use native syntax for coroutines

Forwarded: no
---
 memory_profiler.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/memory_profiler.py b/memory_profiler.py
index f0b52cd..e03993f 100644
--- a/memory_profiler.py
+++ b/memory_profiler.py
@@ -10,7 +10,6 @@ _CMD_USAGE = "python -m memory_profiler script_file.py"
 from asyncio import iscoroutinefunction
 from contextlib import contextmanager
 from functools import partial, wraps
-from types import coroutine
 import builtins
 import inspect
 import linecache
@@ -750,10 +749,9 @@ class LineProfiler(object):
         """
 
         if iscoroutinefunction(func):
-            @coroutine
-            def f(*args, **kwargs):
+            async def f(*args, **kwargs):
                 with self._count_ctxmgr():
-                    res = yield from func(*args, **kwargs)
+                    res = await func(*args, **kwargs)
                     return res
         else:
             def f(*args, **kwds):
@@ -1175,10 +1173,9 @@ def profile(func=None, stream=None, precision=1, backend='psutil'):
         )
         if iscoroutinefunction(func):
             @wraps(wrapped=func)
-            @coroutine
-            def wrapper(*args, **kwargs):
+            async def wrapper(*args, **kwargs):
                 prof = get_prof()
-                val = yield from prof(func)(*args, **kwargs)
+                val = await prof(func)(*args, **kwargs)
                 show_results_bound(prof)
                 return val
         else:
