@@ -358,10 +358,7 @@ def CaptureNamedVariable(self, name, value, depth, limits):
358358 """
359359 try :
360360 if not hasattr (name , '__dict__' ):
361- if isinstance (name , unicode ):
362- name = name .encode ('unicode_escape' )
363- else :
364- name = str (name )
361+ name = str (name )
365362 else : # TODO(vlif): call str(name) with immutability verifier here.
366363 name = str (id (name ))
367364 self ._total_size += len (name )
@@ -451,8 +448,9 @@ def CaptureVariable(self, value, depth, limits, can_enqueue=True):
451448 # Do not use iteritems() here. If GC happens during iteration (which it
452449 # often can for dictionaries containing large variables), you will get a
453450 # RunTimeError exception.
451+ items = [(repr (k ), v ) for (k , v ) in value .items ()]
454452 return {'members' :
455- self .CaptureVariablesList (value . items () , depth + 1 ,
453+ self .CaptureVariablesList (items , depth + 1 ,
456454 EMPTY_DICTIONARY , limits ),
457455 'type' : 'dict' }
458456
@@ -493,16 +491,10 @@ def CaptureVariable(self, value, depth, limits, can_enqueue=True):
493491 self ._total_size += len (r )
494492 return {'value' : r }
495493
496- if value .__dict__ :
497- v = self .CaptureVariable (value .__dict__ , depth + 1 , limits )
498- else :
499- v = {'members' :
500- [
501- {'status' : {
502- 'is_error' : False ,
503- 'refers_to' : 'VARIABLE_NAME' ,
504- 'description' : {'format' : OBJECT_HAS_NO_FIELDS }}}
505- ]}
494+ # Add an additional depth for the object itself
495+ members = self .CaptureVariablesList (value .__dict__ .items (), depth + 2 ,
496+ OBJECT_HAS_NO_FIELDS , limits )
497+ v = {'members' : members }
506498
507499 object_type = type (value )
508500 if hasattr (object_type , '__name__' ):
0 commit comments