[issue26140] inspect.iscoroutinefunction raises TypeError when checks Mock of function or coroutinefunction

Michael Foord report at bugs.python.org
Tue Jan 19 04:39:28 EST 2016


Michael Foord added the comment:

In inspect checking that __code__ is a code object, or that co_flags is an int, would be better than special casing mock. 

However, the patch to mock looks reasonable to me. It copies the whole code object from the original function to the mock object. The patch needs a test (I'd like to see a test for the Mock(func) case and the create_autospec(func) case.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26140>
_______________________________________


More information about the Python-bugs-list mailing list