[New-bugs-announce] [issue34291] UnboundLocalError raised on call to global

Camille report at bugs.python.org
Tue Jul 31 06:51:35 EDT 2018


New submission from Camille <camilledesvernois at gmail.com>:

In the following code :

def g():
    return 0

def f():
    g = g()

f()

The call to g in f fails due to an UnboundLocalError, while I expected the assignment to hide the global definition of g. Note that if it is done in two subsequent calls, i.e. with :
def f():
    goo = g()
    g = 0

The first assignment still fails.

----------
messages: 322755
nosy: camshaka
priority: normal
severity: normal
status: open
title: UnboundLocalError raised on call to global
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34291>
_______________________________________


More information about the New-bugs-announce mailing list