Message 187627 - Python tracker (original) (raw)

Attached a new patch that improves the following things:

There are still several problems though:

While compiling I got this warning: ./setup.py:330: SyntaxWarning: "name 'why' is already defined but implicitly deleted after end of except clause" except ImportError as why:

This comes from a code like: try: foo() except Exception as why: pass try: bar() except Exception as why: pass

and in this case there shouldn't be any warning. A possible way to fix this is to keep a "whitelist" of locals that are first defined as an except target, but then it will still break if there's a why = ... between the two try/except and it's starting to get too complicated...