From: Robert Bradshaw <robertwb@math.washington.edu>
Date: Wed, 7 Nov 2007 17:48:16 +0000 (-0800)
Subject: docstrings for special methods and cpdef functions
X-Git-Tag: 0.9.6.14~29^2~97
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=31aa906818dedacad349f0b86db79ce87078247f;p=cython.git

docstrings for special methods and cpdef functions
---

diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py
index 2479dd87..70d3b214 100644
--- a/Cython/Compiler/Nodes.py
+++ b/Cython/Compiler/Nodes.py
@@ -783,7 +783,7 @@ class CFuncDefNode(FuncDefNode):
                                    args = self.declarator.args,
                                    star_arg = None,
                                    starstar_arg = None,
-                                   doc = None, # self.doc,
+                                   doc = self.doc,
                                    body = py_func_body)
             self.py_func.analyse_declarations(env)
             # Reset scope entry the above cfunction
@@ -1026,7 +1026,7 @@ class DefNode(FuncDefNode):
             Naming.pymethdef_prefix + prefix + name
         if not Options.docstrings:
             self.entry.doc = None
-        elif not entry.is_special:
+        else:
             if Options.embed_pos_in_docstring:
                 entry.doc = 'File: %s (starting at line %s)'%relative_position(self.pos)
                 if not self.doc is None:
diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py
index 86cc03f1..bd4b0eb7 100644
--- a/Cython/Compiler/Parsing.py
+++ b/Cython/Compiler/Parsing.py
@@ -1862,12 +1862,13 @@ def p_c_func_or_var_declaration(s, level, pos, visibility = 'private', api = 0,
     if s.sy == ':':
         if level not in ('module', 'c_class'):
             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,
             visibility = visibility,
             base_type = base_type,
             declarator = declarator, 
             body = suite,
+            doc = doc,
             modifiers = modifiers,
             api = api,
             overridable = overridable)