diff options
author | mathieui <mathieui@mathieui.net> | 2021-12-13 21:25:41 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-12-13 21:25:41 +0100 |
commit | be6dde17f16e85b50361a3db243e9b2e40b2cb5d (patch) | |
tree | 35b9f3cf15303684e821641cb1adf0ed72464296 /slixmpp/xmlstream/handler | |
parent | 14ae84d6661e7966125e0e6853074818bf83ec05 (diff) | |
download | slixmpp-be6dde17f16e85b50361a3db243e9b2e40b2cb5d.tar.gz slixmpp-be6dde17f16e85b50361a3db243e9b2e40b2cb5d.tar.bz2 slixmpp-be6dde17f16e85b50361a3db243e9b2e40b2cb5d.tar.xz slixmpp-be6dde17f16e85b50361a3db243e9b2e40b2cb5d.zip |
Revert "Replace asyncio.ensure_future() with asyncio.create_task()"
This reverts commit bac6a4b2bf2fc98401e0de7168c4a5cf31b08b37.
This is not actually something we want
Diffstat (limited to 'slixmpp/xmlstream/handler')
-rw-r--r-- | slixmpp/xmlstream/handler/coroutine_callback.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/slixmpp/xmlstream/handler/coroutine_callback.py b/slixmpp/xmlstream/handler/coroutine_callback.py index 1ebe3ae4..524cca54 100644 --- a/slixmpp/xmlstream/handler/coroutine_callback.py +++ b/slixmpp/xmlstream/handler/coroutine_callback.py @@ -6,7 +6,7 @@ # :license: MIT, see LICENSE for more details from __future__ import annotations -import asyncio +from asyncio import iscoroutinefunction, ensure_future from typing import Optional, Callable, Awaitable, TYPE_CHECKING from slixmpp.xmlstream.stanzabase import StanzaBase @@ -52,7 +52,7 @@ class CoroutineCallback(BaseHandler): pointer: CoroutineFunction, once: bool = False, instream: bool = False, stream: Optional[XMLStream] = None): BaseHandler.__init__(self, name, matcher, stream) - if not asyncio.iscoroutinefunction(pointer): + if not iscoroutinefunction(pointer): raise ValueError("Given function is not a coroutine") async def pointer_wrapper(stanza: StanzaBase) -> None: @@ -87,7 +87,7 @@ class CoroutineCallback(BaseHandler): :meth:`prerun()`. Defaults to ``False``. """ if not self._instream or instream: - asyncio.create_task(self._pointer(payload)) + ensure_future(self._pointer(payload)) if self._once: self._destroy = True del self._pointer |