declarator = p_c_declarator(s, ctx, cmethod_flag = cmethod_flag,
assignable = 1, nonempty = 1)
declarators.append(declarator)
+ doc_line = s.start_line + 1
s.expect_newline("Syntax error in C variable declaration")
- if ctx.level == 'c_class':
- doc_pos = s.position()
+ if ctx.level == 'c_class' and s.start_line == doc_line:
doc = p_doc_string(s)
- if doc and ctx.visibility not in ('public', 'readonly'):
- warning(doc_pos, "Private attributes don't support docstrings.", 1)
else:
doc = None
result = Nodes.CVarDefNode(pos,
None
>>> print (Ext.attr4.__doc__)
attr4 docstring
+ >>> print (Ext.attr5.__doc__)
+ attr5: 'int'
+ attr5 docstring
>>> print (Ext.a.__doc__)
Ext.a(self)
cdef public attr1
"""attr1 docstring"""
cdef public list attr2
- cdef public Ext attr3
+ cdef public Ext attr3
+
+ """NOT attr3 docstring"""
cdef int attr4
+ cdef public int \
+ attr5
+ """attr5 docstring"""
CONST1, CONST2 = 1, 2