Debug mode assumes coroutine callables have __name__

On python 3.4.3, the following code will work when running without debug mode
enabled, and raise an exception when run with PYTHONASYNCIODEBUG=1:

import asyncio
import functools

@asyncio.coroutine
def func(x, y):
    print('func with x = {} and y = {}'.format(x, y))
    yield from asyncio.sleep(0.1)
    print('exit func')


partial_func = asyncio.coroutine(functools.partial(func, 1))

loop = asyncio.get_event_loop()
try:
    loop.run_until_complete(partial_func(2))
finally:
    loop.close()

Line 154 of asyncio.coroutines tries to copy some attributes of the wrapped
function to its CoroWrapper instance, which fails because the partial object
has no __name__:

AttributeError: 'functools.partial' object has no attribute '__name__'

Original issue reported on code.google.com by mwfrojd...@gmail.com on 31 Mar 2015 at 2:16