From: William Stein Date: Thu, 11 Jan 2007 06:25:21 +0000 (-0800) Subject: Get rid of this sort of error: "Cannot assign type 'gsl_complex' to 'gsl_complex'" X-Git-Tag: 0.9.6.14~29^2~200^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a48ee51299894459ef2d1f3e46698326a25093ed;p=cython.git Get rid of this sort of error: "Cannot assign type 'gsl_complex' to 'gsl_complex'" The solution in this patch is somewhat hackish, but should be OK. --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 1569f5e0..1ef2642f 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -467,7 +467,10 @@ class ExprNode(Node): elif src.type.is_pyobject: src = CoerceFromPyTypeNode(dst_type, src, env) else: # neither src nor dst are py types - if not dst_type.assignable_from(src_type): + # Added the string comparison, since for c types that + # is enough, but SageX 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'" % (src.type, dst_type)) return src diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 34a63ce3..c343e5f2 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -90,7 +90,7 @@ class PyrexType: return self.same_as_resolved_type(other_type.resolve(), **kwds) def same_as_resolved_type(self, other_type): - return self is other_type or other_type is error_type + return self == other_type or other_type is error_type def subtype_of(self, other_type): return self.subtype_of_resolved_type(other_type.resolve())