BUG: Fix variable declaration after statement.

Some declarations that are not at the beginning of a block have slipped
into the code. This breaks compilation on Python3.4a1. The Numpy coding
standard also disallows that construct.

Closes #3598.