src = CoerceFromPyTypeNode(dst_type, src, env)
else: # neither src nor dst are py types
# Added the string comparison, since for c types that
- # is enough, but SageX gets confused when the types are
+ # is enough, but Cython gets confused when the types are
# in different files.
if not (str(src.type) == str(dst_type) or dst_type.assignable_from(src_type)):
error(self.pos, "Cannot assign type '%s' to '%s'" %
def coerce_to(self, dst_type, env):
value = self.value
if dst_type.is_numeric:
- return IntNode(self.pos, value=self.value).coerce_to(dst_type, env)
+ return IntNode(self.pos, value=int(self.value)).coerce_to(dst_type, env)
else:
return PyConstNode.coerce_to(self, dst_type, env)
if name == "None":
return ExprNodes.NoneNode(pos)
elif name == "True":
- return ExprNodes.BoolNode(pos, value=1)
+ return ExprNodes.BoolNode(pos, value=True)
elif name == "False":
- return ExprNodes.BoolNode(pos, value=0)
+ return ExprNodes.BoolNode(pos, value=False)
else:
return p_name(s, name)
elif sy == 'NULL':
pass
else:
rep = repr(value)
- if isinstance(value, int):
+ if isinstance(value, bool):
+ return ExprNodes.BoolNode(pos, value = value)
+ elif isinstance(value, int):
return ExprNodes.IntNode(pos, value = rep)
elif isinstance(value, long):
return ExprNodes.LongNode(pos, value = rep)