Commit 5a3da515 authored by Stefan Behnel's avatar Stefan Behnel

adapt temp handling and type checking in BoolBinopNode to new delayed temp cleanup

parent a1fbea79
......@@ -9671,6 +9671,12 @@ class BoolBinopNode(ExprNode):
self.operand1 = self.operand1.analyse_types(env)
self.operand2 = self.operand2.analyse_types(env)
self.type = PyrexTypes.independent_spanning_type(self.operand1.type, self.operand2.type)
if self.type.is_error:
# incompatible C types, try if we can calculate everything in Python space
self.type = py_object_type
if not self.type.is_pyobject:
if self.operand1.is_ephemeral() or self.operand2.is_ephemeral():
error(self.pos, "Unsafe C derivative of temporary Python reference used in and/or expression")
self.operand1 = self.operand1.coerce_to(self.type, env)
self.operand2 = self.operand2.coerce_to(self.type, env)
......@@ -9714,6 +9720,12 @@ class BoolBinopNode(ExprNode):
self.operand1.free_temps(code)
code.putln("}")
def generate_subexpr_disposal_code(self, code):
pass # nothing to do here, all done in generate_evaluation_code()
def free_subexpr_temps(self, code):
pass # nothing to do here, all done in generate_evaluation_code()
def generate_operand1_test(self, code):
# Generate code to test the truth of the first operand.
if self.type.is_pyobject:
......
......@@ -74,3 +74,23 @@ def test_more_args_adding(s):
'abxyzqr'
"""
return cfunc3(1, b"a" + b"b" + s + b"q" + b"r", 'xyz%d' % 3)
cdef char* ret_charptr(char* s):
return s
def test_charptr_and_charptr_func(char* s):
"""
>>> test_charptr_and_charptr_func(b'abc') == b'abc'
True
"""
return s and ret_charptr(s)
def test_charptr_and_ucharptr(char* s):
"""
>>> test_charptr_and_ucharptr(b'abc') == b'abc'
True
"""
return s and <unsigned char*>s
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment