commit: 3917544bf2cc438b571effd00df8545d51736ffc
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Tue Dec 8 07:20:07 2015 +0000
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever <AT> apache <DOT> org>
CommitDate: Tue Dec 8 07:20:07 2015 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3917544b
bin/socks5-server.py: Fix DeprecationWarning with Python >=3.4.4.
asyncio.async() is deprecated in favor of asyncio.ensure_future().
bin/socks5-server.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/bin/socks5-server.py b/bin/socks5-server.py
index 71e6b01..cfe3ece 100644
--- a/bin/socks5-server.py
+++ b/bin/socks5-server.py
@@ -10,6 +10,13 @@ import socket
import struct
import sys
+if hasattr(asyncio, 'ensure_future'):
+ # Python >=3.4.4.
+ asyncio_ensure_future = asyncio.ensure_future
+else:
+ # getattr() necessary because async is a keyword in Python >=3.7.
+ asyncio_ensure_future = getattr(asyncio, 'async')
+
class Socks5Server(object):
"""
@@ -141,7 +148,7 @@ class Socks5Server(object):
# otherwise, start two loops:
# remote -> local...
- t = asyncio.async(self.handle_proxied_conn(
+ t = asyncio_ensure_future(self.handle_proxied_conn(
proxied_reader, writer,
asyncio.Task.current_task()))
# and local -> remote...