[New-bugs-announce] [issue6148] Help well execute code it is called on

Ian Miers report at bugs.python.org
Sat May 30 08:37:21 CEST 2009

New submission from Ian Miers <imichaelmiers at gmail.com>:

when calling help() from the python interpreter on a function 
whose default argument is provided by another function 
( e.g. def foo(bar=baz() ) : .... ), help will call baz().

This can cause problems because baz() can alter statefull
data  like a file or database entry. 

This is both a bug in that it does this and in that
its undocumented 

To see this download the attached file and then : 
Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bug
>>> help(bug)

at this point the file bug now has been written to disk. 
This is a problem

I've got to think there is a reason for this, but seeing as I cant 
come up with it , better safe than sorry.

assignee: georg.brandl
components: Documentation, Interpreter Core
files: bug.py
messages: 88565
nosy: georg.brandl, imiers1
severity: normal
status: open
title: Help well execute code it is called on
type: behavior
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file14120/bug.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list