summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ModuleNode.py
diff options
context:
space:
mode:
authorRobert Bradshaw <robertwb@gmail.com>2014-01-08 15:28:54 -0800
committerRobert Bradshaw <robertwb@gmail.com>2014-01-08 15:28:54 -0800
commitc054d0d2df10f10b550d2e1098c69cd10b42be17 (patch)
tree9f873a3acc2409edbf1d43110fa623bc25988933 /Cython/Compiler/ModuleNode.py
parentc66eca2998704181d92f2db84eec461dd5683af1 (diff)
parent521ed9d8537144970d232e009dd97448224de6db (diff)
downloadcython-c054d0d2df10f10b550d2e1098c69cd10b42be17.tar.gz
Merge pull request #270 from ohanar/special_method_docstring_guard
Special method docstring guard
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r--Cython/Compiler/ModuleNode.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 338efc08d..e38d9344e 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -2538,6 +2538,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
'__releasebuffer__')
if (func.is_special and Options.docstrings and
func.wrapperbase_cname and not is_buffer):
+ slot = TypeSlots.method_name_to_slot[func.name]
+ preprocessor_guard = slot.preprocessor_guard_code()
+ if preprocessor_guard:
+ code.putln(preprocessor_guard)
code.putln('#if CYTHON_COMPILING_IN_CPYTHON')
code.putln("{")
code.putln(
@@ -2558,6 +2562,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("}")
code.putln("}")
code.putln('#endif')
+ if preprocessor_guard:
+ code.putln('#endif')
if type.vtable_cname:
code.putln(
"if (__Pyx_SetVtable(%s.tp_dict, %s) < 0) %s" % (