From 55ad7f709218136e60b6837315ad65ce0120b874 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 28 Nov 2010 16:55:56 +0100 Subject: [PATCH] test case for ticket #601 --- tests/bugs.txt | 1 + tests/run/for_from_pyvar_loop_T601.pyx | 54 +++++++++++++++++++ .../run/for_from_pyvar_loop_T601_extern_def.h | 2 + 3 files changed, 57 insertions(+) create mode 100644 tests/run/for_from_pyvar_loop_T601.pyx create mode 100644 tests/run/for_from_pyvar_loop_T601_extern_def.h diff --git a/tests/bugs.txt b/tests/bugs.txt index 0f6ecba0..8c69c30d 100644 --- a/tests/bugs.txt +++ b/tests/bugs.txt @@ -17,6 +17,7 @@ closure_inside_cdef_T554 ipow_crash_T562 pure_mode_cmethod_inheritance_T583 genexpr_iterable_lookup_T600 +for_from_pyvar_loop_T601 # CPython regression tests that don't current work: pyregr.test_threadsignals diff --git a/tests/run/for_from_pyvar_loop_T601.pyx b/tests/run/for_from_pyvar_loop_T601.pyx new file mode 100644 index 00000000..11b7e195 --- /dev/null +++ b/tests/run/for_from_pyvar_loop_T601.pyx @@ -0,0 +1,54 @@ + +cdef unsigned long size2(): + return 3 + +def for_from_plain_ulong(): + """ + >>> for_from_plain_ulong() + 0 + 1 + 2 + """ + cdef object j = 0 + for j from 0 <= j < size2(): + print j + +def for_in_plain_ulong(): + """ + >>> for_in_plain_ulong() + 0 + 1 + 2 + """ + cdef object j = 0 + for j in range(size2()): + print j + + +cdef extern from "for_from_pyvar_loop_T601_extern_def.h": + ctypedef unsigned long Ulong + +cdef Ulong size(): + return 3 + +def for_from_ctypedef_ulong(): + """ + >>> for_from_ctypedef_ulong() + 0 + 1 + 2 + """ + cdef object j = 0 + for j from 0 <= j < size(): + print j + +def for_in_ctypedef_ulong(): + """ + >>> for_in_ctypedef_ulong() + 0 + 1 + 2 + """ + cdef object j = 0 + for j in range(size()): + print j diff --git a/tests/run/for_from_pyvar_loop_T601_extern_def.h b/tests/run/for_from_pyvar_loop_T601_extern_def.h new file mode 100644 index 00000000..b6330a99 --- /dev/null +++ b/tests/run/for_from_pyvar_loop_T601_extern_def.h @@ -0,0 +1,2 @@ + +typedef unsigned long Ulong; -- 2.26.2