##// END OF EJS Templates
harden reporting against failures for objects which break when dir() is called on them.
fperez -
Show More
@@ -60,7 +60,7 b' You can implement other color schemes easily, the syntax is fairly'
60 self-explanatory. Please send back new schemes you develop to the author for
60 self-explanatory. Please send back new schemes you develop to the author for
61 possible inclusion in future releases.
61 possible inclusion in future releases.
62
62
63 $Id: ultraTB.py 951 2005-12-25 00:57:24Z fperez $"""
63 $Id: ultraTB.py 954 2005-12-26 19:40:50Z fperez $"""
64
64
65 #*****************************************************************************
65 #*****************************************************************************
66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
@@ -550,7 +550,18 b' class VerboseTB(TBTools):'
550 exception = ['%s%s%s: %s' % (Colors.excName, etype_str,
550 exception = ['%s%s%s: %s' % (Colors.excName, etype_str,
551 ColorsNormal, evalue_str)]
551 ColorsNormal, evalue_str)]
552 if type(evalue) is types.InstanceType:
552 if type(evalue) is types.InstanceType:
553 names = [w for w in dir(evalue) if isinstance(w, basestring)]
553 try:
554 names = [w for w in dir(evalue) if isinstance(w, basestring)]
555 except:
556 # Every now and then, an object with funny inernals blows up
557 # when dir() is called on it. We do the best we can to report
558 # the problem and continue
559 _m = '%sException reporting error (object with broken dir())%s:'
560 exception.append(_m % (Colors.excName,ColorsNormal))
561 etype_str,evalue_str = map(str,sys.exc_info()[:2])
562 exception.append('%s%s%s: %s' % (Colors.excName,etype_str,
563 ColorsNormal, evalue_str))
564 names = []
554 for name in names:
565 for name in names:
555 value = text_repr(getattr(evalue, name))
566 value = text_repr(getattr(evalue, name))
556 exception.append('\n%s%s = %s' % (indent, name, value))
567 exception.append('\n%s%s = %s' % (indent, name, value))
@@ -1,5 +1,8 b''
1 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2
2
3 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
4 failures for objects which break when dir() is called on them.
5
3 * IPython/FlexCompleter.py (Completer.__init__): Added support for
6 * IPython/FlexCompleter.py (Completer.__init__): Added support for
4 distinct local and global namespaces in the completer API. This
7 distinct local and global namespaces in the completer API. This
5 change allows us top properly handle completion with distinct
8 change allows us top properly handle completion with distinct
General Comments 0
You need to be logged in to leave comments. Login now