[master 5/9] Don't use [] as the default argument in a method.

clumens installerbot-noreply at redhat.com
Fri Jul 17 13:50:10 UTC 2015


From: Chris Lumens <clumens at redhat.com>

---
 meh/dump.py        | 5 ++++-
 tests/baseclass.py | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/meh/dump.py b/meh/dump.py
index 4c9af70..cac3878 100644
--- a/meh/dump.py
+++ b/meh/dump.py
@@ -291,7 +291,7 @@ def _format_stack(self):
 
     # Create a string representation of a class.  This method will recursively
     # handle all attributes of the base given class.
-    def _dumpClass(self, instance, level=0, parentkey="", skipList=[]):
+    def _dumpClass(self, instance, level=0, parentkey="", skipList=None):
         # This is horribly cheesy, and bound to require maintainence in the
         # future.  The problem is that anything subclassed from object fails
         # the types.InstanceType test we used to have which means those
@@ -315,6 +315,9 @@ def __isSimpleType(instance):
 
         ret = SafeStr()
 
+        if not skipList:
+            skipList = []
+
         # protect from loops
         try:
             # Store the id(), not the instance name to protect against
diff --git a/tests/baseclass.py b/tests/baseclass.py
index 78ca1e2..007a372 100644
--- a/tests/baseclass.py
+++ b/tests/baseclass.py
@@ -42,9 +42,12 @@ def tracebackContains(self, path, str):
         f.close()
         return False
 
-def loadModules(moduleDir, cls_pattern="_TestCase", skip_list=["__init__", "baseclass"]):
+def loadModules(moduleDir, cls_pattern="_TestCase", skip_list=None):
     '''taken from firstboot/loader.py'''
 
+    if not skip_list:
+        skip_list = ["__init__", "baseclass"]
+
     # Guaruntee that __init__ is skipped
     if skip_list.count("__init__") == 0:
         skip_list.append("__init__")


-- 
To view this commit on github, visit https://github.com/rhinstaller/python-meh/commit/6567362534a8cf4bae53ca6d195f3e3f8c3687ec


More information about the anaconda-patches mailing list