Fixes: https://pagure.io/koji/issue/844
:thumbsup:
Ah, I had forgotten that python3 added this. My brain still clings to the global/locals (+closure) scope model in py2.
https://stackoverflow.com/questions/45292479/name-binding-in-except-clause-deleted-after-the-clause
It's not technically implemented as a scope though. Granted, from a practical perspective, the difference is irrelevant.
This PEP intends to resolve this issue by adding a cleanup semantic to except clauses in Python 3 whereby the target name is deleted at the end of the except suite.
There are similar behavior changes with list comprehensions and generator expressions. Those are apperently implemented with function scopes.
Kind of a style nit, but having task_error shift from boolean to exception bugs me...
https://github.com/mikem23/koji-playground/commits/pagure/pr/845
Also, I'm trying to remember why we deferred raising the exception until after the loop.
This code has been refactored a few times and I think it used to matter, but I don't see how it does not. We get an error, we save the exception object, we break, and then we re-raise if we got the error. Looks like the flow would be the same if we just moved that bit into the exception handler, except we'd get a cleaner exception because we could just use a bare raise.
Or maybe I'm missing something in my haste...
rebased onto 54d720072ca345afd31f590838353a163606d5e4
I was going through history and that behaviour is there from beginning of git, so not sure what is there. I'm also not able to reinvent the reason, so I've tried to remove it. I've also added small optimization to not check for same result twice - it shouldn't hurt.
rebased onto 716092eb944dd4b71cd7d3b4a591d8722cc5e250
rebased onto 633bfe1a31c5b07618793aaec2289d11875ef5d7
koji/tasks.py:393:76: F841 local variable 'ex' is assigned to but never used
Looks good otherwise
removed
1 new commit added
remove unused variable
Commit 77ae912f fixes this pull-request
Pull-Request has been merged by mikem
Fixes: https://pagure.io/koji/issue/844