From a5ea68905a6ad2486827de35a49e2f25da4a8ee8 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 1 Jun 2007 11:33:33 +0000 Subject: [PATCH] Bug #1722484: remove docstrings again when running with -OO. --- Misc/NEWS | 2 ++ Python/compile.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index 33c45ca4bdb..ade26da267e 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,8 @@ What's New in Python 2.6 alpha 1? Core and builtins ----------------- +- Bug #1722484: remove docstrings again when running with -OO. + - Add new attribute names for function objects. All the func_* become __*__ attributes. (Some already existed, e.g., __doc__ and __name__.) diff --git a/Python/compile.c b/Python/compile.c index f051d13ee5e..01dbb1aaa3a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1119,7 +1119,8 @@ compiler_body(struct compiler *c, asdl_seq *stmts) if (!asdl_seq_LEN(stmts)) return 1; st = (stmt_ty)asdl_seq_GET(stmts, 0); - if (compiler_isdocstring(st)) { + if (compiler_isdocstring(st) && Py_OptimizeFlag < 2) { + /* don't generate docstrings if -OO */ i = 1; VISIT(c, expr, st->v.Expr.value); if (!compiler_nameop(c, __doc__, Store))