Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

The code

def foo(x):
    print y
    y = x

Works in Cython (printing None) but throws an error in Python. This is because all local variables are set to None at the top of a function.

Instead, all locals should be set to 0, with an error being raised on incorrect use. A question is whether or not the C compiler is smart enough to eliminate this check once assignment has been made (especially if it is directly, e.g. via a c attribute). Would the resulting incref be enough?

Some code flow analysis could also be done to clear variables only in the blocks they are used.

Something went wrong with that request. Please try again.