From 52679b28bd2936ffb11b7ef4f9eb4a5ecb8dd865 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 4 Dec 2009 06:36:17 +0100 Subject: [PATCH] infer builtin/extension types from type constructors --- Cython/Compiler/ExprNodes.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 2b6a9bfc..9cd91dde 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -1072,8 +1072,8 @@ class NameNode(AtomicExprNode): elif (self.entry.type.is_extension_type or self.entry.type.is_builtin_type) and \ self.name == self.entry.type.name: # Unfortunately the type attribute of type objects - # is used for the pointer to the type the represent. - return type_type + # is used for the pointer to the type they represent. + return self.entry.type # type_type else: return self.entry.type @@ -2396,6 +2396,11 @@ class SimpleCallNode(CallNode): func_type = func_type.base_type if func_type.is_cfunction: return func_type.return_type + elif func_type.is_extension_type: + return func_type + elif func_type.is_builtin_type and \ + func_type.name in Builtin.types_that_construct_their_instance: + return func_type else: return py_object_type -- 2.26.2