On Thu, 16 Feb 2017 14:28:57 +1100, Chris Angelico wrote:

> On Thu, Feb 16, 2017 at 1:25 PM, Steven D'Aprano <st...@pearwood.info>
> wrote:
>> This has been in production for months, the writer of the code has left
>> and the new maintainer has been asked to find out why it has been
>> crashing with UnboundLocalError:
[...]

> Without even looking at the link.... 'except pass' around an assignment.
> Unless there's a preceding "result = some-other-object",
> that's going to annoyingly fail. Maybe "except return None"?

Oh, we know why the code is failing. We don't need help diagnosing the 
UnboundLocalError exception. You're right: there's an except pass around 
an assignment, so if the assignment fails, `result` never gets set.

But the real WTF is that the ConnectionError is just thrown away. There's 
no attempt to recover from it, or log it, or try connecting again... the 
end result is that the application dies with an unhelpful 
UnboundLocalError, and (until today) we had no idea what the actual cause 
of the failure was.


[Name changed to protect the guilty]

Thanks Aloysius!!!




-- 
Steve
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to