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):
132
132
res = yield from await_meth ()
133
133
return res
134
134
135
+ coro = types .coroutine (coro )
135
136
if not _DEBUG :
136
- wrapper = types . coroutine ( coro )
137
+ wrapper = coro
137
138
else :
138
139
@functools .wraps (func )
139
140
def wrapper (* args , ** kwds ):
Original file line number Diff line number Diff line change 9
9
import random
10
10
import re
11
11
import sys
12
+ import textwrap
12
13
import types
13
14
import unittest
14
15
import weakref
@@ -3090,6 +3091,22 @@ async def inner():
3090
3091
result = self .loop .run_until_complete (inner ())
3091
3092
self .assertEqual (['ok1' , 'ok2' ], result )
3092
3093
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
+
3093
3110
3094
3111
if __name__ == '__main__' :
3095
3112
unittest .main ()
You can’t perform that action at this time.
0 commit comments