[issue29909] types.coroutine monkey patches original function

2017-03-26 Thread Eric Hopper
Eric Hopper added the comment: Here's an update to types.coroutine that fixes the problem for me. -- Added file: http://bugs.python.org/file46756/types.coroutine.py ___ Python tracker

[issue29909] types.coroutine monkey patches original function

2017-03-26 Thread Yury Selivanov
Yury Selivanov added the comment: Yeah, we can fix this. However, I don't want to push the fix to 3.6, too much code uses this function now. So it's going to be 3.7 only. -- assignee: -> yselivanov versions: +Python 3.7 -Python 3.6 ___ Python

[issue29909] types.coroutine monkey patches original function

2017-03-26 Thread R. David Murray
R. David Murray added the comment: Oops, I didn't meant to close this. -- resolution: not a bug -> stage: resolved -> status: closed -> open ___ Python tracker

[issue29909] types.coroutine monkey patches original function

2017-03-26 Thread R. David Murray
R. David Murray added the comment: Yes, that looks wrong to me. IMO it should be returning a new function object, not updating the __code__ of the existing object. I couldn't figure when that is actually triggered, though. There are also some other oddnesses, given the definition of

[issue29909] types.coroutine monkey patches original function

2017-03-26 Thread Eric Hopper
New submission from Eric Hopper: The types.coroutine decorator for Python 3.6 (and I suspect for Python 3.6.1 as well) simply monkey patches the function it's passed and then returns it. This results in behavior that I found somewhat surprising. def bar(): yield 5 foo =