diff options
author | Zac Medico <zmedico@gentoo.org> | 2019-01-15 20:15:18 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2019-01-15 23:49:00 -0800 |
commit | 707a230042658e98b329c0a9141bc17d80a2f454 (patch) | |
tree | 3334980694bd90b99558964fc7c1220554ff509f | |
parent | tests: add unit test for portage.util.socks5 (FEATURES=network-sandbox-proxy) (diff) | |
download | portage-707a2300.tar.gz portage-707a2300.tar.bz2 portage-707a2300.zip |
bin/socks5-server.py: fix PendingDeprecationWarning for asyncio.Task.current_task()
PendingDeprecationWarning: Task.current_task() is deprecated, use asyncio.current_task() instead
Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r-- | bin/socks5-server.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bin/socks5-server.py b/bin/socks5-server.py index d46cf5345..f5d995f0d 100644 --- a/bin/socks5-server.py +++ b/bin/socks5-server.py @@ -17,6 +17,12 @@ else: # getattr() necessary because async is a keyword in Python >=3.7. asyncio_ensure_future = getattr(asyncio, 'async') +try: + current_task = asyncio.current_task +except AttributeError: + # Deprecated since Python 3.7 + current_task = asyncio.Task.current_task + class Socks5Server(object): """ @@ -154,7 +160,7 @@ class Socks5Server(object): # otherwise, start two loops: # remote -> local... t = asyncio_ensure_future(self.handle_proxied_conn( - proxied_reader, writer, asyncio.Task.current_task())) + proxied_reader, writer, current_task())) # and local -> remote... try: |