From 9262420f987e3215b11aecb5fe703846931e1daf Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Sun, 3 Aug 2008 19:51:46 +0200 Subject: [PATCH] Fixed bug with BoolNode result_code --- Cython/Compiler/ExprNodes.py | 2 +- tests/run/bint.pyx | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/run/bint.pyx diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index a37f9e75..636e162f 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -628,7 +628,7 @@ class BoolNode(ConstNode): return self.value def calculate_result_code(self): - return int(self.value) + return str(int(self.value)) class NullNode(ConstNode): type = PyrexTypes.c_null_ptr_type diff --git a/tests/run/bint.pyx b/tests/run/bint.pyx new file mode 100644 index 00000000..827cf042 --- /dev/null +++ b/tests/run/bint.pyx @@ -0,0 +1,25 @@ + +""" +>>> call_test() +False +True +False +True +True +True +True +""" + +cdef test(bint value): + print value + +def call_test(): + test(False) + test(True) + test(0) + test(234) + test(-1) + x = True + test(x) + x = 3242 + test(x) -- 2.26.2