From: Dag Sverre Seljebotn Date: Fri, 19 Sep 2008 14:38:34 +0000 (+0200) Subject: Cython optimizations regarding embedding signatures X-Git-Tag: 0.9.9.2.beta~95^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3ed359ce27484e2ebddb4044908490355ea0b0a1;p=cython.git Cython optimizations regarding embedding signatures --- 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