From a48ee51299894459ef2d1f3e46698326a25093ed Mon Sep 17 00:00:00 2001 From: William Stein Date: Wed, 10 Jan 2007 22:25:21 -0800 Subject: [PATCH] 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. --- Cython/Compiler/ExprNodes.py | 5 ++++- Cython/Compiler/PyrexTypes.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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()) -- 2.26.2