From 3ed359ce27484e2ebddb4044908490355ea0b0a1 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Fri, 19 Sep 2008 16:38:34 +0200 Subject: [PATCH] Cython optimizations regarding embedding signatures --- Cython/Compiler/AutoDocTransforms.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/AutoDocTransforms.py b/Cython/Compiler/AutoDocTransforms.py index a4484841..3bb990b1 100644 --- a/Cython/Compiler/AutoDocTransforms.py +++ b/Cython/Compiler/AutoDocTransforms.py @@ -89,6 +89,14 @@ class EmbedSignature(CythonTransform): else: return signature + + def __call__(self, node): + if not Options.docstrings: + return node + else: + self.visitchildren(node) + return node + def visit_ClassDefNode(self, node): oldincls = self.is_in_class oldname = self.class_name @@ -105,6 +113,9 @@ class EmbedSignature(CythonTransform): return node def visit_FuncDefNode(self, node): + if not node.options['embedsignature']: + return node + signature = None if type(node) is DefNode: # def FOO(...): special_method = (self.is_in_class and \ @@ -126,7 +137,6 @@ class EmbedSignature(CythonTransform): else: # should not fall here ... assert False if signature: - if Options.docstrings and node.options['embedsignature']: - new_doc = self._embed_signature(signature, node.doc) - node.doc = EncodedString(new_doc) # XXX + new_doc = self._embed_signature(signature, node.doc) + node.doc = EncodedString(new_doc) # XXX return node -- 2.26.2