From da8db8ca186ab8a811b44b90816b57b6f20caa61 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 29 Aug 2001 17:19:02 +0000 Subject: [PATCH] Don't include doc string of class in its code child --- Lib/compiler/transformer.py | 5 +++++ Tools/compiler/compiler/transformer.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Lib/compiler/transformer.py b/Lib/compiler/transformer.py index 7f6a1b4a2c7..7f615958dab 100644 --- a/Lib/compiler/transformer.py +++ b/Lib/compiler/transformer.py @@ -222,6 +222,11 @@ def classdef(self, nodelist): # code for class code = self.com_node(nodelist[-1]) + if doc is not None: + assert isinstance(code, Stmt) + assert isinstance(code.nodes[0], Discard) + del code.nodes[0] + n = Class(name, bases, doc, code) n.lineno = nodelist[1][2] return n diff --git a/Tools/compiler/compiler/transformer.py b/Tools/compiler/compiler/transformer.py index 7f6a1b4a2c7..7f615958dab 100644 --- a/Tools/compiler/compiler/transformer.py +++ b/Tools/compiler/compiler/transformer.py @@ -222,6 +222,11 @@ def classdef(self, nodelist): # code for class code = self.com_node(nodelist[-1]) + if doc is not None: + assert isinstance(code, Stmt) + assert isinstance(code.nodes[0], Discard) + del code.nodes[0] + n = Class(name, bases, doc, code) n.lineno = nodelist[1][2] return n