From 556f15c6d13b6f9e60dd263aee09a4c9f27d7cf2 Mon Sep 17 00:00:00 2001 From: daniloaf Date: Fri, 19 Feb 2010 14:39:44 -0300 Subject: [PATCH] Fix on constructor call from cimported C++ classes --- Cython/Compiler/ExprNodes.py | 3 ++- Cython/Compiler/Parsing.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 1c04e93e..37ccce03 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -1049,7 +1049,8 @@ class NewExprNode(AtomicExprNode): # template_parameters None or [ExprNode] temlate parameters, if any def infer_type(self, env): - entry = env.lookup(self.cppclass) + cppclass = self.cppclass.analyse_as_type(env) + entry = env.lookup(cppclass.name) if entry is None or not entry.is_cpp_class: error(self.pos, "new operator can only be applied to a C++ class") return diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index 3f545c10..984b156b 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -316,7 +316,11 @@ def p_new_expr(s): # s.systring == 'new'. pos = s.position() s.next() - name = p_ident(s) + node = p_atom(s) + if s.sy == '.': + name = p_trailer(s, node) + else: + name = node if s.sy == '[': s.next() template_parameters = p_simple_expr_list(s) -- 2.26.2