diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index c11ad43bca6c685acffb5dbb317818767654a349..6356e78fe59520e929a40872e68d5ef831110436 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1495,10 +1495,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): for entry in py_attrs: var_code = "p->%s" % entry.cname + var_as_pyobject = PyrexTypes.typecast(py_object_type, entry.type, var_code) code.putln("if (%s) {" % var_code) - if entry.type.is_extension_type: - var_code = "((PyObject*)%s)" % var_code - code.putln("e = (*v)(%s, a); if (e) return e;" % var_code) + code.putln("e = (*v)(%s, a); if (e) return e;" % var_as_pyobject) code.putln("}") # Traverse buffer exporting objects.