New submission from Daniele Varrazzo:
The issue was already addressed in Issue1722485.
The fix applied in rev. 55732, 55733 only fixes module and class
docstrings, not function docstrings.
The attached patch fixed the issue for function docstrings too.
----------
components: None
files: fix_function_docstring.patch
messages: 55945
nosy: piro
severity: normal
status: open
title: Option -OO doesn't remove docstrings from functions
type: compile error
versions: Python 2.5
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1169>
__________________________________
--- 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);
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com