]> 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:45 +0000 (11:33 +0000)
committerGeorg Brandl <georg@python.org>
Fri, 1 Jun 2007 11:33:45 +0000 (11:33 +0000)
 (backport from rev. 55732)

Misc/NEWS
Python/compile.c

index 8e6a0494e8df39a4b05bf814c16c4a84aac3825d..1757bffab72f4d635e26a9803504c8f816fddeee 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -58,6 +58,8 @@ What's New in Python 2.5.1?
 Core and builtins
 -----------------
 
+- Bug #1722484: remove docstrings again when running with -OO.
+
 - Revert SF #1615701: dict.update() does *not* call __getitem__() or keys()
   if subclassed.  This is to remain consistent with 2.5.
   Also revert revision 53667 with made a similar change to set.update().
index e493beb6c2fe9be9e14f4356a8f294a7d12ff5dd..5ac170295244f6b3de43802e896e5782e596ea5c 100644 (file)
@@ -1779,7 +1779,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))