From 350afcafd80019952c37e1509861429b9a403d9b Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 13 Apr 2011 19:58:56 +0200 Subject: [PATCH] fix #675: make 'by' a non-keyword also in .pyx files --- Cython/Compiler/Parsing.py | 2 +- Cython/Compiler/Scanning.py | 2 +- tests/run/for_decrement.pyx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 -- 2.26.2