File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -132,8 +132,9 @@ def coro(*args, **kw):
132132 res = yield from await_meth ()
133133 return res
134134
135+ coro = types .coroutine (coro )
135136 if not _DEBUG :
136- wrapper = types . coroutine ( coro )
137+ wrapper = coro
137138 else :
138139 @functools .wraps (func )
139140 def wrapper (* args , ** kwds ):
Original file line number Diff line number Diff line change 99import random
1010import re
1111import sys
12+ import textwrap
1213import types
1314import unittest
1415import weakref
@@ -3090,6 +3091,22 @@ async def inner():
30903091 result = self .loop .run_until_complete (inner ())
30913092 self .assertEqual (['ok1' , 'ok2' ], result )
30923093
3094+ def test_debug_mode_interop (self ):
3095+ # https://bugs.python.org/issue32636
3096+ code = textwrap .dedent ("""
3097+ import asyncio
3098+
3099+ async def native_coro():
3100+ pass
3101+
3102+ @asyncio.coroutine
3103+ def old_style_coro():
3104+ yield from native_coro()
3105+
3106+ asyncio.run(old_style_coro())
3107+ """ )
3108+ assert_python_ok ("-c" , code , PYTHONASYNCIODEBUG = "1" )
3109+
30933110
30943111if __name__ == '__main__' :
30953112 unittest .main ()
You can’t perform that action at this time.
0 commit comments