]> granicus.if.org Git - python/commitdiff
Bug #1722484: remove docstrings again when running with -OO.
authorGeorg Brandl <georg@python.org>
Fri, 1 Jun 2007 11:33:33 +0000 (11:33 +0000)
committerGeorg Brandl <georg@python.org>
Fri, 1 Jun 2007 11:33:33 +0000 (11:33 +0000)
Misc/NEWS
Python/compile.c

index 33c45ca4bdb7edde88cd6df3f4798d615459dd05..ade26da267e91e4617bd4ca7e60572e20d46f98c 100644 (file)
--- 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__.)
 
index f051d13ee5e910cb2ef20aa25fcf807171336775..01dbb1aaa3ac84dc9bee4924bd88e4a41f393124 100644 (file)
@@ -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))