summaryrefslogtreecommitdiff
path: root/pysnmp
diff options
context:
space:
mode:
authorMichal Arbet <arbet.michal@gmail.com>2018-07-31 15:48:23 +0300
committerIlya Etingof <etingof@gmail.com>2018-07-31 14:48:23 +0200
commit0fba331b55b4508eadb3b0cd3ae21568165b2492 (patch)
treeef54a0704675fb359893d488c0fac0860fbb1b32 /pysnmp
parent2048a9230312caa51486b42b590956f72a6d3f8f (diff)
downloadpysnmp-git-0fba331b55b4508eadb3b0cd3ae21568165b2492.tar.gz
Fix py3.7 syntax error caused by async keyword (#180)
As async is the keyword since Python 3.7, let's use gettattr built-in function to call async function from asyncio.
Diffstat (limited to 'pysnmp')
-rw-r--r--pysnmp/carrier/asyncio/dgram/base.py4
-rw-r--r--pysnmp/carrier/asyncio/dispatch.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/pysnmp/carrier/asyncio/dgram/base.py b/pysnmp/carrier/asyncio/dgram/base.py
index e06e8ee5..93e58457 100644
--- a/pysnmp/carrier/asyncio/dgram/base.py
+++ b/pysnmp/carrier/asyncio/dgram/base.py
@@ -90,7 +90,7 @@ class DgramAsyncioProtocol(asyncio.DatagramProtocol, AbstractAsyncioTransport):
if IS_PYTHON_344_PLUS:
self._lport = asyncio.ensure_future(c)
else: # pragma: no cover
- self._lport = asyncio.async(c)
+ self._lport = getattr(asyncio, 'async')(c)
except Exception:
raise error.CarrierError(';'.join(traceback.format_exception(*sys.exc_info())))
@@ -101,7 +101,7 @@ class DgramAsyncioProtocol(asyncio.DatagramProtocol, AbstractAsyncioTransport):
c = self.loop.create_datagram_endpoint(
lambda: self, local_addr=iface, family=self.sockFamily
)
- self._lport = asyncio.async(c)
+ self._lport = getattr(asyncio, 'async')(c)
except Exception:
raise error.CarrierError(';'.join(traceback.format_exception(*sys.exc_info())))
return self
diff --git a/pysnmp/carrier/asyncio/dispatch.py b/pysnmp/carrier/asyncio/dispatch.py
index 2ba4cf4d..74f9ae10 100644
--- a/pysnmp/carrier/asyncio/dispatch.py
+++ b/pysnmp/carrier/asyncio/dispatch.py
@@ -75,7 +75,7 @@ class AsyncioDispatcher(AbstractTransportDispatcher):
if IS_PYTHON_344_PLUS:
self.loopingcall = asyncio.ensure_future(self.handle_timeout())
else: # pragma: no cover
- self.loopingcall = asyncio.async(self.handle_timeout())
+ self.loopingcall = getattr(asyncio, 'async')(self.handle_timeout())
AbstractTransportDispatcher.registerTransport(
self, tDomain, transport
)