summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-07-03 04:35:29 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-07-03 04:35:29 (GMT)
commitb166d58b9ea00ef4147efd5db99fd340228139c7 (patch)
tree6e3a3ba98e7c700e2a4b58043d07e98bf77182f7
parentd6d0b5b1fa5cb0b4c8645e3446189b348dcf344c (diff)
parent53e623075dbcba2afaffc859c2fae9bff48e9abf (diff)
downloadcpython-b166d58b9ea00ef4147efd5db99fd340228139c7.zip
cpython-b166d58b9ea00ef4147efd5db99fd340228139c7.tar.gz
cpython-b166d58b9ea00ef4147efd5db99fd340228139c7.tar.bz2
Merge 3.5 (Issue #24450)
-rw-r--r--Lib/test/test_types.py7
-rw-r--r--Lib/types.py4
2 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index e283f32..ba8a1b9 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -1295,8 +1295,8 @@ class CoroutineTests(unittest.TestCase):
self.assertIs(wrapper.__name__, gen.__name__)
# Test AttributeErrors
- for name in {'gi_running', 'gi_frame', 'gi_code',
- 'cr_running', 'cr_frame', 'cr_code'}:
+ for name in {'gi_running', 'gi_frame', 'gi_code', 'gi_yieldfrom',
+ 'cr_running', 'cr_frame', 'cr_code', 'cr_await'}:
with self.assertRaises(AttributeError):
getattr(wrapper, name)
@@ -1304,12 +1304,15 @@ class CoroutineTests(unittest.TestCase):
gen.gi_running = object()
gen.gi_frame = object()
gen.gi_code = object()
+ gen.gi_yieldfrom = object()
self.assertIs(wrapper.gi_running, gen.gi_running)
self.assertIs(wrapper.gi_frame, gen.gi_frame)
self.assertIs(wrapper.gi_code, gen.gi_code)
+ self.assertIs(wrapper.gi_yieldfrom, gen.gi_yieldfrom)
self.assertIs(wrapper.cr_running, gen.gi_running)
self.assertIs(wrapper.cr_frame, gen.gi_frame)
self.assertIs(wrapper.cr_code, gen.gi_code)
+ self.assertIs(wrapper.cr_await, gen.gi_yieldfrom)
wrapper.close()
gen.close.assert_called_once_with()
diff --git a/Lib/types.py b/Lib/types.py
index 38b453a..8c5fc65 100644
--- a/Lib/types.py
+++ b/Lib/types.py
@@ -188,9 +188,13 @@ class _GeneratorWrapper:
@property
def gi_running(self):
return self.__wrapped.gi_running
+ @property
+ def gi_yieldfrom(self):
+ return self.__wrapped.gi_yieldfrom
cr_code = gi_code
cr_frame = gi_frame
cr_running = gi_running
+ cr_await = gi_yieldfrom
def __next__(self):
return next(self.__wrapped)
def __iter__(self):