[issue1169] Option -OO doesn't remove docstrings from functions

2007-09-18 Thread Georg Brandl

Georg Brandl added the comment:

Fixed in rev. 58204, 58205 (2.5).

--
resolution:  -> fixed
status: open -> closed

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1169] Option -OO doesn't remove docstrings from functions

2007-09-18 Thread Sean Reifschneider

Changes by Sean Reifschneider:


--
assignee:  -> georg.brandl
nosy: +georg.brandl
priority:  -> normal

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1169] Option -OO doesn't remove docstrings from functions

2007-09-16 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1169] Option -OO doesn't remove docstrings from functions

2007-09-16 Thread Daniele Varrazzo

Daniele Varrazzo added the comment:

The attached file shows the issue: running with -OO no docstring should
be printed.

In rev 58163 the functions docstrings are still printed.

__
Tracker <[EMAIL PROTECTED]>

__"""Module docstring"""

class Test:
"""Class docstring"""
def test(self):
"""Method docstring."""
pass

def fun():
"""Function docstring."""
pass

print 'module', __doc__
print 'class', Test.__doc__
print 'method', Test.test.__doc__
print 'fun', fun.__doc__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1169] Option -OO doesn't remove docstrings from functions

2007-09-16 Thread Daniele Varrazzo

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]>

__--- compile.c.bak	2007-09-16 17:23:43.0 +0200
+++ compile.c	2007-09-16 17:26:38.0 +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