Gentoo Archives: gentoo-commits

From: Arfrever Frehtes Taifersar Arahesis <arfrever@××××××.org>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Tue, 08 Dec 2015 07:23:18
Message-Id: 1449559207.3917544bf2cc438b571effd00df8545d51736ffc.arfrever@gentoo
1 commit: 3917544bf2cc438b571effd00df8545d51736ffc
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Tue Dec 8 07:20:07 2015 +0000
4 Commit: Arfrever Frehtes Taifersar Arahesis <arfrever <AT> apache <DOT> org>
5 CommitDate: Tue Dec 8 07:20:07 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3917544b
7
8 bin/socks5-server.py: Fix DeprecationWarning with Python >=3.4.4.
9
10 asyncio.async() is deprecated in favor of asyncio.ensure_future().
11
12 bin/socks5-server.py | 9 ++++++++-
13 1 file changed, 8 insertions(+), 1 deletion(-)
14
15 diff --git a/bin/socks5-server.py b/bin/socks5-server.py
16 index 71e6b01..cfe3ece 100644
17 --- a/bin/socks5-server.py
18 +++ b/bin/socks5-server.py
19 @@ -10,6 +10,13 @@ import socket
20 import struct
21 import sys
22
23 +if hasattr(asyncio, 'ensure_future'):
24 + # Python >=3.4.4.
25 + asyncio_ensure_future = asyncio.ensure_future
26 +else:
27 + # getattr() necessary because async is a keyword in Python >=3.7.
28 + asyncio_ensure_future = getattr(asyncio, 'async')
29 +
30
31 class Socks5Server(object):
32 """
33 @@ -141,7 +148,7 @@ class Socks5Server(object):
34
35 # otherwise, start two loops:
36 # remote -> local...
37 - t = asyncio.async(self.handle_proxied_conn(
38 + t = asyncio_ensure_future(self.handle_proxied_conn(
39 proxied_reader, writer, asyncio.Task.current_task()))
40
41 # and local -> remote...