Xiang Zhang added the comment:
Not a bug. Put the global statement inside:
>>> variable = 'test'
>>> def changeVariable():
... exec("global variable; variable = 'newText'")
...
>>> changeVariable()
>>> print(variable)
newText
--
nosy: +xiang.zhang
resolution: -> not a bug
stage:
New submission from Qwert225:
String executed inside a function ignores global statements stated before
string execution.
See the example below - the global variable value should be changed to
'newText' by the function, but is not.
Example:
variable = 'text'
def changeVariable():
global