]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Add warning/error handlin for problematic nested scopes cases as
authorJeremy Hylton <jeremy@alum.mit.edu>
Wed, 28 Feb 2001 22:54:51 +0000 (22:54 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Wed, 28 Feb 2001 22:54:51 +0000 (22:54 +0000)
commit4419ac1a97d445f3fadacbf7b25c4cfc258c733b
treeea6b906dcc88b8c32c937122772474e4cce11fbd
parent150a6640f5f63d2dd32e823b619b6afdf3d1b8c1
Add warning/error handlin for problematic nested scopes cases as
described in PEP 227.

symtable_check_unoptimized() warns about import * and exec with "in"
when it is used in a function that contains a nested function with
free variables.  Warnings are issued unless nested scopes are in
effect, in which case these are SyntaxErrors.

symtable_check_shadow() warns about assignments in a function scope
that shadow free variables defined in a nested scope.  This will
always generate a warning -- and will behave differently with nested
scopes than without.

Restore full checking for free vars in children, even when nested
scopes are not enabled.  This is needed to support warnings for
shadowing.

Change symtable_warn() to return an int-- the return value of
PyErr_WarnExplicit.

Sundry cleanup: Remove commented out code.  Break long lines.
Python/compile.c