[issue40126] Incorrect error handling in unittest.mock

2020-04-11 Thread Barry McLarnon
Barry McLarnon added the comment: Issue still exists in 3.7 and below, as it was part of a different function before. Current PR doesn't resolve the original issue that was raised. -- versions: +Python 3.5, Python 3.6 ___ Python tracker &

[issue40126] Incorrect error handling in unittest.mock

2020-04-03 Thread Barry McLarnon
Change by Barry McLarnon : -- components: +Library (Lib) -Tests ___ Python tracker <https://bugs.python.org/issue40126> ___ ___ Python-bugs-list mailin

[issue40126] Incorrect error handling in unittest.mock

2020-04-03 Thread Barry McLarnon
Barry McLarnon added the comment: After further investigation, it seems this was fixed in https://github.com/python/cpython/commit/436c2b0d67da68465e709a96daac7340af3a5238 However, this fix was as part of an unrelated changeset and in a different function in 3.8+, and was never rolled back

[issue40126] Incorrect error handling in unittest.mock

2020-03-31 Thread Barry McLarnon
New submission from Barry McLarnon : The error handling in mock.decorate_callable (3.5-3.7) and mock.decoration_helper (3.8-3.9) is incorrectly implemented. If the error handler is triggered in the loop, the `patching` variable is out of scope and raises an unhandled `UnboundLocalError