From: daniloaf Date: Fri, 19 Feb 2010 17:39:44 +0000 (-0300) Subject: Fix on constructor call from cimported C++ classes X-Git-Tag: 0.13.beta0~345 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=556f15c6d13b6f9e60dd263aee09a4c9f27d7cf2;p=cython.git Fix on constructor call from cimported C++ classes --- 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)