Commit cc2740ed authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Fix #677

parent c0c11c66
......@@ -1253,7 +1253,8 @@ if VALUE is not None:
def visit_CNameDeclaratorNode(self, node):
if node.name in self.seen_vars_stack[-1]:
entry = self.env_stack[-1].lookup(node.name)
if entry is None or entry.visibility != 'extern':
if (entry is None or entry.visibility != 'extern'
and not entry.scope.is_c_class_scope):
warning(node.pos, "cdef variable '%s' declared after it is used" % node.name, 2)
self.visitchildren(node)
return node
......
# mode: run
# tag: cdefclass, #677
"""
>>> str(Foo(4))
'4'
>>> x
3
"""
x = 3
cdef int y
cdef class Foo:
cdef int x
cdef int y
def __init__(self, x):
self.x = x
def __str__(self):
return str(self.x)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment