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
Gwenaël Samain
cython
Commits
e4b86647
Commit
e4b86647
authored
Mar 04, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test case from #1685.
parent
e8d30965
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
runtests.py
runtests.py
+1
-0
tests/run/py35_asyncio_async_def.srctree
tests/run/py35_asyncio_async_def.srctree
+58
-0
No files found.
runtests.py
View file @
e4b86647
...
...
@@ -372,6 +372,7 @@ VER_DEP_MODULES = {
(3,4,999): (operator.gt, lambda x: x in ['run.initial_file_path',
]),
(3,5): (operator.lt, lambda x: x in ['run.py35_pep492_interop',
'run.py35_asyncio_async_def',
'run.mod__spec__',
'run.pep526_variable_annotations', # typing module
]),
...
...
tests/run/py35_asyncio_async_def.srctree
0 → 100644
View file @
e4b86647
# mode: run
# tag: asyncio, gh1685
PYTHON setup.py build_ext -i
PYTHON main.py
######## setup.py ########
from Cython.Build import cythonize
from distutils.core import setup
setup(
ext_modules = cythonize("*.pyx"),
)
######## main.py ########
import asyncio
import cy_test
from contextlib import closing
async def main():
await cy_test.say()
with closing(asyncio.get_event_loop()) as loop:
print("Running Python coroutine ...")
loop.run_until_complete(main())
print("Running Cython coroutine ...")
loop.run_until_complete(cy_test.say())
######## cy_test.pyx ########
import asyncio
from py_test import py_async
async def cy_async():
print("- this one is from Cython")
async def say():
await cb()
async def cb(): # renaming this to "say" would prevent crash
print("awaiting:")
await cy_async()
await py_async()
print("sleeping:")
await asyncio.sleep(3)
print("done!")
######## py_test.py ########
async def py_async():
print("- and this one is from Python")
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