New submission from Gareth Williams <gareth.m.j.willi...@gmail.com>:
unitest.mock.patch does not work well when applied as a decorator to a function which is a generator. It results in the function being changed from a generator function (co_flags 99) to a non-generator (co_flag 31) and the patch is not applied. [I have a MWE, attached, and fairly simple fix, to the file mock.py, which I will put up as a PR in due course. This is the first time I've submitted a bug or PR, so apologies if I've not done this particularly well.] ---------- components: Library (Lib) files: example_patch_failure.py messages: 398104 nosy: garethmjwilliams priority: normal severity: normal status: open title: unittest.mock.patch does not work as a decorator on generator functions type: enhancement versions: Python 3.8 Added file: https://bugs.python.org/file50176/example_patch_failure.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44730> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com