David added the comment: I made the syntax error go away by moving the global current_user above the try......
I will have to revisit this one when time permits and write a script that recreates the error. This will probably be later this week. Thanks for your volunteer service. David On Jul 9, 2017 10:42 PM, "Steven D'Aprano" <rep...@bugs.python.org> wrote: > > Steven D'Aprano added the comment: > > Please copy and paste (don't retype from memory!) the *exact* error you > are getting. > > You should be seeing something like: > > SyntaxWarning: name 'current_user' is used prior to global declaration > > (at least that's the warning I'm getting in Python 3.5), which is correct > behaviour. The name is used prior to the global declaration. > > The Python interpreter is now discouraging the use of the "global" keyword > anywhere except at the top of the function. (It may some day become an > error.) > > If your code is unindented module-level code, as your code snippet > suggests, you don't need the global declaration since current_user is > automatically global. > > If it is function-level code, then move the global declaration to the top > of the function, as the SyntaxWarning suggests. > > I don't believe this is a bug, I believe that what you are seeing is > expected, so I am closing this bug report. If I have misunderstood what you > are experiencing, then please re-open the ticket and give us some more > information. Preferably give us some code that we can run that demonstrates > the error. (Since the error doesn't have anything to do with flask, the > `import flask` line is unnecessary.) > > ---------- > nosy: +steven.daprano > > _______________________________________ > Python tracker <rep...@bugs.python.org> > <http://bugs.python.org/issue30887> > _______________________________________ > ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30887> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com