Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
c02a14ee
Commit
c02a14ee
authored
Aug 09, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.23.x'
Conflicts: CHANGES.rst
parents
ed6f70af
a8d8a5d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
1 deletion
+52
-1
CHANGES.rst
CHANGES.rst
+10
-0
Cython/Utility/Coroutine.c
Cython/Utility/Coroutine.c
+1
-1
tests/run/test_coroutines_pep492.pyx
tests/run/test_coroutines_pep492.pyx
+41
-0
No files found.
CHANGES.rst
View file @
c02a14ee
...
...
@@ -18,6 +18,16 @@ Other changes
-------------
0.23.1 (2015-08-xx)
===================
Bugs fixed
----------
* Misnamed coroutine property ``cr_yieldfrom`` changed to ``cr_await``
to match CPython.
0.23 (2015-08-08)
=================
...
...
Cython/Utility/Coroutine.c
View file @
c02a14ee
...
...
@@ -1174,7 +1174,7 @@ static PyMethodDef __pyx_Coroutine_methods[] = {
static
PyMemberDef
__pyx_Coroutine_memberlist
[]
=
{
{(
char
*
)
"cr_running"
,
T_BOOL
,
offsetof
(
__pyx_CoroutineObject
,
is_running
),
READONLY
,
NULL
},
{(
char
*
)
"cr_
yieldfrom
"
,
T_OBJECT
,
offsetof
(
__pyx_CoroutineObject
,
yieldfrom
),
READONLY
,
{(
char
*
)
"cr_
await
"
,
T_OBJECT
,
offsetof
(
__pyx_CoroutineObject
,
yieldfrom
),
READONLY
,
(
char
*
)
PyDoc_STR
(
"object being awaited, or None"
)},
{
0
,
0
,
0
,
0
,
0
}
};
...
...
tests/run/test_coroutines_pep492.pyx
View file @
c02a14ee
...
...
@@ -463,6 +463,14 @@ class CoroutineTest(unittest.TestCase):
def
assertIn
(
self
,
member
,
container
,
msg
=
None
):
self
.
assertTrue
(
member
in
container
,
msg
)
if
not
hasattr
(
unittest
.
TestCase
,
'assertIsNone'
):
def
assertIsNone
(
self
,
value
,
msg
=
None
):
self
.
assertTrue
(
value
is
None
,
msg
)
if
not
hasattr
(
unittest
.
TestCase
,
'assertIsNotNone'
):
def
assertIsNotNone
(
self
,
value
,
msg
=
None
):
self
.
assertTrue
(
value
is
not
None
,
msg
)
def
test_gen_1
(
self
):
def
gen
():
yield
self
.
assertFalse
(
hasattr
(
gen
,
'__await__'
))
...
...
@@ -684,6 +692,39 @@ class CoroutineTest(unittest.TestCase):
"coroutine ignored GeneratorExit"
):
c
.
close
()
def
test_cr_await
(
self
):
@
types_coroutine
def
a
():
#self.assertEqual(inspect.getcoroutinestate(coro_b), inspect.CORO_RUNNING)
self
.
assertIsNone
(
coro_b
.
cr_await
)
yield
#self.assertEqual(inspect.getcoroutinestate(coro_b), inspect.CORO_RUNNING)
# FIXME: no idea why the following works in CPython:
#self.assertIsNone(coro_b.cr_await)
async
def
c
():
await
a
()
async
def
b
():
self
.
assertIsNone
(
coro_b
.
cr_await
)
await
c
()
self
.
assertIsNone
(
coro_b
.
cr_await
)
coro_b
=
b
()
#self.assertEqual(inspect.getcoroutinestate(coro_b), inspect.CORO_CREATED)
self
.
assertIsNone
(
coro_b
.
cr_await
)
coro_b
.
send
(
None
)
#self.assertEqual(inspect.getcoroutinestate(coro_b), inspect.CORO_SUSPENDED)
#self.assertEqual(coro_b.cr_await.cr_await.gi_code.co_name, 'a')
self
.
assertIsNotNone
(
coro_b
.
cr_await
.
cr_await
)
self
.
assertEqual
(
coro_b
.
cr_await
.
cr_await
.
__name__
,
'a'
)
with
self
.
assertRaises
(
StopIteration
):
coro_b
.
send
(
None
)
# complete coroutine
#self.assertEqual(inspect.getcoroutinestate(coro_b), inspect.CORO_CLOSED)
self
.
assertIsNone
(
coro_b
.
cr_await
)
def
test_corotype_1
(
self
):
async
def
f
():
pass
ct
=
type
(
f
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment