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 <rep...@bugs.python.org> <http://bugs.python.org/issue26140> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com