This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author oleksandr.suvorov
Recipients Mark.Shannon, oleksandr.suvorov, pablogsal
Date 2020-05-22.11:20:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CACYZ_wJ7G2bvr2BC5jgpNPQs+UoiLcTJEaThapNYT4WBZKi3Pw@mail.gmail.com>
In-reply-to <CACYZ_wJorVRV6CKBLO=Jgq46xme1MJNnUmQ-V0WuPN-AfA7e0A@mail.gmail.com>
Content
What I mean is why would it need to shadow function variable name if after
except block it's always unbound, what is the reason and why this is
expected?

On Fri, May 22, 2020 at 1:19 PM Oleksandr Suvorov <report@bugs.python.org>
wrote:

>
> Oleksandr Suvorov <susliko@gmail.com> added the comment:
>
> but if exc variable is only available in except block why then it shadows
> the function variable name?
>
> On Fri, May 22, 2020 at 1:15 PM Christian Heimes <report@bugs.python.org>
> wrote:
>
> >
> > Christian Heimes <lists@cheimes.de> added the comment:
> >
> > UnboundLocalError is a subclass of NameError. You are getting a more
> > specific error here.
> >
> > >>> UnboundLocalError.__mro__
> > (<class 'UnboundLocalError'>, <class 'NameError'>, <class 'Exception'>,
> > <class 'BaseException'>, <class 'object'>)
> >
> > ----------
> > nosy: +christian.heimes
> >
> > _______________________________________
> > Python tracker <report@bugs.python.org>
> > <https://bugs.python.org/issue40728>
> > _______________________________________
> >
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue40728>
> _______________________________________
>
History
Date User Action Args
2020-05-22 11:20:23oleksandr.suvorovsetrecipients: + oleksandr.suvorov, Mark.Shannon, pablogsal
2020-05-22 11:20:23oleksandr.suvorovlinkissue40728 messages
2020-05-22 11:20:23oleksandr.suvorovcreate