The changes for code execution registered the
authorThomas Hunger <hto@arcor.de>
Wed, 19 Sep 2007 22:28:47 +0000 (00:28 +0200)
committerThomas Hunger <hto@arcor.de>
Wed, 19 Sep 2007 22:28:47 +0000 (00:28 +0200)
scope-entry as a variable. This means that
analyse_attribute expects to find a pointer to
a member of the c-object struct.
This is not the case for members, so we need a
special case.

Cython/Compiler/ExprNodes.py

index 06067b5f79912eeff55babe38ab15f2025006865..ac974a6bbb316b7491e58c49d23ddd0c13305e0c 100644 (file)
@@ -1684,10 +1684,13 @@ class AttributeNode(ExprNode):
             if entry:
                 if obj_type.is_extension_type and entry.name == "__weakref__":
                     error(self.pos, "Illegal use of special attribute __weakref__")
-                if entry.is_variable or entry.is_cmethod:
-                    self.type = entry.type
-                    self.member = entry.cname
-                    return
+                # methods need the normal attribute lookup
+                # because they do not have struct entries
+                if not entry.is_method:
+                    if entry.is_variable or entry.is_cmethod:
+                        self.type = entry.type
+                        self.member = entry.cname
+                        return
                 else:
                     # If it's not a variable or C method, it must be a Python
                     # method of an extension type, so we treat it like a Python