summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pysnmp/carrier/asyncio/dgram/base.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pysnmp/carrier/asyncio/dgram/base.py b/pysnmp/carrier/asyncio/dgram/base.py
index 93e58457..af649db6 100644
--- a/pysnmp/carrier/asyncio/dgram/base.py
+++ b/pysnmp/carrier/asyncio/dgram/base.py
@@ -101,7 +101,11 @@ class DgramAsyncioProtocol(asyncio.DatagramProtocol, AbstractAsyncioTransport):
c = self.loop.create_datagram_endpoint(
lambda: self, local_addr=iface, family=self.sockFamily
)
- self._lport = getattr(asyncio, 'async')(c)
+ # Avoid deprecation warning for asyncio.async()
+ if IS_PYTHON_344_PLUS:
+ self._lport = asyncio.ensure_future(c)
+ else: # pragma: no cover
+ self._lport = getattr(asyncio, 'async')(c)
except Exception:
raise error.CarrierError(';'.join(traceback.format_exception(*sys.exc_info())))
return self