Commit 31aa9068 authored by Robert Bradshaw's avatar Robert Bradshaw

docstrings for special methods and cpdef functions

parent bbda6f56
...@@ -783,7 +783,7 @@ class CFuncDefNode(FuncDefNode): ...@@ -783,7 +783,7 @@ class CFuncDefNode(FuncDefNode):
args = self.declarator.args, args = self.declarator.args,
star_arg = None, star_arg = None,
starstar_arg = None, starstar_arg = None,
doc = None, # self.doc, doc = self.doc,
body = py_func_body) body = py_func_body)
self.py_func.analyse_declarations(env) self.py_func.analyse_declarations(env)
# Reset scope entry the above cfunction # Reset scope entry the above cfunction
...@@ -1026,7 +1026,7 @@ class DefNode(FuncDefNode): ...@@ -1026,7 +1026,7 @@ class DefNode(FuncDefNode):
Naming.pymethdef_prefix + prefix + name Naming.pymethdef_prefix + prefix + name
if not Options.docstrings: if not Options.docstrings:
self.entry.doc = None self.entry.doc = None
elif not entry.is_special: else:
if Options.embed_pos_in_docstring: if Options.embed_pos_in_docstring:
entry.doc = 'File: %s (starting at line %s)'%relative_position(self.pos) entry.doc = 'File: %s (starting at line %s)'%relative_position(self.pos)
if not self.doc is None: if not self.doc is None:
......
...@@ -1862,12 +1862,13 @@ def p_c_func_or_var_declaration(s, level, pos, visibility = 'private', api = 0, ...@@ -1862,12 +1862,13 @@ def p_c_func_or_var_declaration(s, level, pos, visibility = 'private', api = 0,
if s.sy == ':': if s.sy == ':':
if level not in ('module', 'c_class'): if level not in ('module', 'c_class'):
s.error("C function definition not allowed here") s.error("C function definition not allowed here")
suite = p_suite(s, 'function', with_pseudo_doc = 1) doc, suite = p_suite(s, 'function', with_doc = 1)
result = Nodes.CFuncDefNode(pos, result = Nodes.CFuncDefNode(pos,
visibility = visibility, visibility = visibility,
base_type = base_type, base_type = base_type,
declarator = declarator, declarator = declarator,
body = suite, body = suite,
doc = doc,
modifiers = modifiers, modifiers = modifiers,
api = api, api = api,
overridable = overridable) overridable = overridable)
......
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