--- compile.c.bak 2007-09-16 17:23:43.000000000 +0200 +++ compile.c 2007-09-16 17:26:38.000000000 +0200 @@ -1336,7 +1336,7 @@ st = (stmt_ty)asdl_seq_GET(s->v.FunctionDef.body, 0); docstring = compiler_isdocstring(st); - if (docstring) + if (docstring && Py_OptimizeFlag < 2) first_const = st->v.Expr.value->v.Str.s; if (compiler_add_o(c, c->u->u_consts, first_const) < 0) { compiler_exit_scope(c);