chiark / gitweb /
Using a mutable default function argument is bad
Python function arguments can have default values. These values are
objects that are created when the "def" statement is run, not when the
function is called. These objects are thus persistent across calls to
that function. If a mutable object, such as a list, is used as a
default argument, that object will retain its value across function
calls. This is potentially unwanted behavior if the function is called
multiple times.
Fix up function argument defaults in stgit/git.py, for safety.
Signed-off-by: Chuck Lever <cel@netapp.com>