From 703802857e8e609469816ea3434ede923c2be1c7 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Wed, 30 Sep 2015 01:05:28 -0400 Subject: [PATCH] Support patchless use of backports_abc 0.4 --- maint/test/cython/cythonapp_test.py | 7 ------- maint/test/cython/tox.ini | 4 ++-- tornado/gen.py | 9 ++++++--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/maint/test/cython/cythonapp_test.py b/maint/test/cython/cythonapp_test.py index c3312de41..0af465abb 100644 --- a/maint/test/cython/cythonapp_test.py +++ b/maint/test/cython/cythonapp_test.py @@ -1,10 +1,3 @@ -try: - import backports_abc -except ImportError: - raise -else: - backports_abc.patch() - from tornado.testing import AsyncTestCase, gen_test from tornado.util import ArgReplacer import unittest diff --git a/maint/test/cython/tox.ini b/maint/test/cython/tox.ini index 38949d52f..8f5b20b1d 100644 --- a/maint/test/cython/tox.ini +++ b/maint/test/cython/tox.ini @@ -5,8 +5,8 @@ envlist = py27,py32,py33,py34,py35 [testenv] deps = ../../.. - Cython>= 0.23.1 - backports_abc + Cython>=0.23.3 + backports_abc>=0.4 singledispatch commands = python -m unittest cythonapp_test # Most of these are defaults, but if you specify any you can't fall back diff --git a/tornado/gen.py b/tornado/gen.py index 10189b8d3..31521b332 100644 --- a/tornado/gen.py +++ b/tornado/gen.py @@ -102,15 +102,18 @@ try: from collections.abc import Generator as GeneratorType # py35+ except ImportError: try: - from collections import Generator as GeneratorType # py2 with backports_abc + from backports_abc import Generator as GeneratorType except ImportError: from types import GeneratorType try: from inspect import isawaitable # py35+ except ImportError: - def isawaitable(x): - return False + try: + from backports_abc import isawaitable + except ImportError: + def isawaitable(x): + return False try: import builtins # py3 -- 2.47.2