From: Stefan Behnel Date: Wed, 13 Apr 2011 17:58:56 +0000 (+0200) Subject: fix #675: make 'by' a non-keyword also in .pyx files X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=350afcafd80019952c37e1509861429b9a403d9b;p=cython.git fix #675: make 'by' a non-keyword also in .pyx files --- diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index 8a123626..a2d38fe8 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -1432,7 +1432,7 @@ def p_for_from_relation(s): s.error("Expected one of '<', '<=', '>' '>='") def p_for_from_step(s): - if s.sy == 'by': + if s.sy == 'IDENT' and s.systring == 'by': s.next() step = p_bit_expr(s) return step diff --git a/Cython/Compiler/Scanning.py b/Cython/Compiler/Scanning.py index 3bb99e9a..608bcb15 100644 --- a/Cython/Compiler/Scanning.py +++ b/Cython/Compiler/Scanning.py @@ -45,7 +45,7 @@ py_reserved_words = [ pyx_reserved_words = py_reserved_words + [ "include", "ctypedef", "cdef", "cpdef", - "cimport", "by", "DEF", "IF", "ELIF", "ELSE" + "cimport", "DEF", "IF", "ELIF", "ELSE" ] class Method(object): diff --git a/tests/run/for_decrement.pyx b/tests/run/for_decrement.pyx index 57db9161..02be71f6 100644 --- a/tests/run/for_decrement.pyx +++ b/tests/run/for_decrement.pyx @@ -33,7 +33,7 @@ def from_loop_indices(): incremented one step after the last iteration. """ cdef int i, j, k - for i from 0 <= i < 10 by get_step(): pass + for i from 0 <= i < 5+5 by get_step(): pass for j from 0 <= j < 10: pass for k from 10 > k > 0: pass return i, j, k