diff --git a/Demos/benchmarks/nqueens.py b/Demos/benchmarks/nqueens.py
index 922a7cebf750f5caedc842f3cd3cf514e4ba35c8..719bb7ca0e9ac68feb084c12b6891f19e0cd9ac7 100644
--- a/Demos/benchmarks/nqueens.py
+++ b/Demos/benchmarks/nqueens.py
@@ -44,6 +44,7 @@ def permutations(iterable):
             return
 
 # From http://code.activestate.com/recipes/576647/
+@cython.locals(queen_count=int, i=int, vec=list)
 def n_queens(queen_count):
     """N-Queens solver.
 
@@ -56,7 +57,7 @@ def n_queens(queen_count):
         (3, 8, 2, 1, 4, ..., 6) where each number is the column position for the
         queen, and the index into the tuple indicates the row.
     """
-    cols = range(queen_count)
+    cols = list(range(queen_count))
     for vec in permutations(cols):
         if (queen_count == len({ vec[i]+i for i in cols })
                         == len({ vec[i]-i for i in cols })):