[issue10189] SyntaxError: no binding for nonlocal doesn't contain a useful traceback

R. David Murray report at bugs.python.org
Tue Oct 26 13:53:14 CEST 2010

R. David Murray <rdmurray at bitdance.com> added the comment:

Yes, but in that particular case the exact line referenced is involved in the error, since it that error is that the symbol is both nonlocal and an argument, and the error points to the head of the block which is the 'def' statement.

Attached is a patch that adds the available line number info to all of the error messages except the one for nonlocal at the global level.  In that case the line number will always be zero, so that does not


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list