[PATCH 2/3] Don't try to dump objects without __dict__

Vratislav Podzimek vpodzime at redhat.com
Mon Aug 20 13:41:21 UTC 2012


Such objects cannot be dumped and we should just print their
string representation.
---
 meh/dump.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meh/dump.py b/meh/dump.py
index bf63a4b..2e8c94a 100644
--- a/meh/dump.py
+++ b/meh/dump.py
@@ -264,7 +264,8 @@ class ExceptionDump(object):
             return type(instance) in [types.BooleanType, types.ComplexType, types.FloatType,
                                       types.IntType, types.LongType, types.NoneType,
                                       types.StringType, types.UnicodeType] or \
-                   not hasattr(instance, "__class__")
+                   not hasattr(instance, "__class__") or \
+                   not hasattr(instance, "__dict__")
 
         ret = ""
 
-- 
1.7.11.2



More information about the anaconda-patches mailing list