Commit 59367485 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix crash for scope=None compilation error, more strict literal char* -> int

parent a68841b6
...@@ -3543,9 +3543,10 @@ class PrimaryCmpNode(ExprNode, CmpNode): ...@@ -3543,9 +3543,10 @@ class PrimaryCmpNode(ExprNode, CmpNode):
or (self.cascade and self.cascade.has_int_operands()) or (self.cascade and self.cascade.has_int_operands())
def coerce_chars_to_ints(self, env): def coerce_chars_to_ints(self, env):
if self.operand1.type.is_string: # coerce literal single-char strings to c chars
if self.operand1.type.is_string and isinstance(self.operand1, StringNode):
self.operand1 = self.operand1.coerce_to(PyrexTypes.c_uchar_type, env) self.operand1 = self.operand1.coerce_to(PyrexTypes.c_uchar_type, env)
if self.operand2.type.is_string: if self.operand2.type.is_string and isinstance(self.operand2, StringNode):
self.operand2 = self.operand2.coerce_to(PyrexTypes.c_uchar_type, env) self.operand2 = self.operand2.coerce_to(PyrexTypes.c_uchar_type, env)
if self.cascade: if self.cascade:
self.cascade.coerce_chars_to_ints(env) self.cascade.coerce_chars_to_ints(env)
...@@ -3636,7 +3637,7 @@ class CascadedCmpNode(Node, CmpNode): ...@@ -3636,7 +3637,7 @@ class CascadedCmpNode(Node, CmpNode):
return self.operand2.type.is_int return self.operand2.type.is_int
def coerce_chars_to_ints(self, env): def coerce_chars_to_ints(self, env):
if self.operand2.type.is_string: if self.operand2.type.is_string and isinstance(self.operand2, StringNode):
self.operand2 = self.operand2.coerce_to(PyrexTypes.c_uchar_type, env) self.operand2 = self.operand2.coerce_to(PyrexTypes.c_uchar_type, env)
def coerce_cascaded_operands_to_temp(self, env): def coerce_cascaded_operands_to_temp(self, env):
......
...@@ -196,6 +196,8 @@ class BlockNode: ...@@ -196,6 +196,8 @@ class BlockNode:
del entries[:] del entries[:]
def generate_py_string_decls(self, env, code): def generate_py_string_decls(self, env, code):
if env is None:
return # earlier error
entries = env.pystring_entries entries = env.pystring_entries
if entries: if entries:
code.putln("") code.putln("")
......
...@@ -6,6 +6,6 @@ cdef class D(C): ...@@ -6,6 +6,6 @@ cdef class D(C):
cdef void f(self, int x): cdef void f(self, int x):
pass pass
_ERRORS = u""" _ERRORS = u"""
/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_cmethbasematch.pyx:6:6: Signature does not match previous declaration /Local/Projects/D/Pyrex/Source/Tests/Errors3/e_cmethbasematch.pyx:6:6: Signature not compatible with previous declaration
/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_cmethbasematch.pyx:2:6: Previous declaration is here /Local/Projects/D/Pyrex/Source/Tests/Errors3/e_cmethbasematch.pyx:2:6: Previous declaration is here
""" """
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