[issue4181] Invalid Behavior When a Default Argument is a Dictionary.
Pasha
report at bugs.python.org
Wed Oct 22 23:52:18 CEST 2008
New submission from Pasha <pavel.kamyshev at yale.edu>:
Whenever the default argument to a function is a dictionary, and the
function is called twice, then the function "remembers" the changes to
the dictionary.
This means that any time that a default argument is set to a dictionary,
a list or any other built in data structure, it cannot be relied upon to
correctly do the right thing.
I assume this is actually two issues:
1) The default arguments are not being garbage collected after the
function is done. You can check that by using a __del__ tracker
2) the argument is at the same memory location at all times.
I have seen this on Python 2.5.2, however its highly possible other
parts are affected as well.
----------
components: Interpreter Core
files: default_argument_dictionary_bug.py
messages: 75114
nosy: Pasha2009
severity: normal
status: open
title: Invalid Behavior When a Default Argument is a Dictionary.
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file11861/default_argument_dictionary_bug.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4181>
_______________________________________
More information about the Python-bugs-list
mailing list