Message 389264 - Python tracker (original) (raw)

I think the issue is that the error message for UnboundLocalError is wrong, see this example:

def g(): ... x = 42 ... del x ... print(x) ... g() Traceback (most recent call last): File "", line 1, in File "", line 4, in g UnboundLocalError: local variable 'x' referenced before assignment

How about we change it to "local variable 'x' referenced before assignment or after deletion"?