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
Boxiang Sun
cython
Commits
d0d63887
Commit
d0d63887
authored
Jan 16, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include required async utility code wherever it's used, not just by accident.
Closes #2075.
parent
f9d11146
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+5
-0
Cython/Utility/AsyncGen.c
Cython/Utility/AsyncGen.c
+1
-0
tests/compile/min_async.pyx
tests/compile/min_async.pyx
+9
-0
No files found.
Cython/Compiler/Nodes.py
View file @
d0d63887
...
...
@@ -4232,6 +4232,9 @@ class GeneratorBodyDefNode(DefNode):
# on normal generator termination, we do not take the exception propagation
# path: no traceback info is required and not creating it is much faster
if
not
self
.
is_inlined
and
not
self
.
body
.
is_terminator
:
if
self
.
is_async_gen_body
:
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"StopAsyncIteration"
,
"Coroutine.c"
))
code
.
putln
(
'PyErr_SetNone(%s);'
%
(
'__Pyx_PyExc_StopAsyncIteration'
if
self
.
is_async_gen_body
else
'PyExc_StopIteration'
))
# ----- Error cleanup
...
...
@@ -5918,6 +5921,8 @@ class ReturnStatNode(StatNode):
if
self
.
return_type
.
is_pyobject
:
if
self
.
in_generator
:
if
self
.
in_async_gen
:
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"StopAsyncIteration"
,
"Coroutine.c"
))
code
.
put
(
"PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); "
)
code
.
putln
(
"%s = NULL;"
%
Naming
.
retval_cname
)
else
:
...
...
Cython/Utility/AsyncGen.c
View file @
d0d63887
...
...
@@ -102,6 +102,7 @@ static int __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) {
//////////////////// AsyncGenerator ////////////////////
//@requires: AsyncGeneratorInitFinalizer
//@requires: Coroutine.c::Coroutine
//@requires: Coroutine.c::ReturnWithStopIteration
//@requires: ObjectHandling.c::PyObjectCallMethod1
...
...
tests/compile/min_async.pyx
0 → 100644
View file @
d0d63887
# Need to include all utility code !
async
def
sleep
(
x
):
pass
async
def
call
():
await
sleep
(
1
)
yield
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