Fixed bug with BoolNode result_code
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Sun, 3 Aug 2008 17:51:46 +0000 (19:51 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Sun, 3 Aug 2008 17:51:46 +0000 (19:51 +0200)
Cython/Compiler/ExprNodes.py
tests/run/bint.pyx [new file with mode: 0644]

index a37f9e751c852fc84202e03ec05e84384a9f6b9a..636e162f1d9e2381a1c50941b52f2558f9313a8c 100644 (file)
@@ -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 (file)
index 0000000..827cf04
--- /dev/null
@@ -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)