Mercurial > p > roundup > code
diff roundup/cgi/cgitb.py @ 5420:7172c201dec2
Python 3 preparation: avoid obsolete types.*Type names.
There are references to types.ListType (not actually used),
types.TupleType (for which tuple is a sufficient replacement) and
types.InstanceType (also removed from the types module in Python 3, it
was the type of instances of old-style classes only). Where
InstanceType is used it's testing whether an exception is a class or
not; support for non-class exceptions was removed in Python 3 and
patch 3 in this series removed the sole instance of one in Roundup, so
making the code in question unconditional seems reasonable.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Wed, 25 Jul 2018 09:10:46 +0000 |
| parents | 64b05e24dbd8 |
| children | 86b6cea7a975 |
line wrap: on
line diff
--- a/roundup/cgi/cgitb.py Wed Jul 25 09:09:28 2018 +0000 +++ b/roundup/cgi/cgitb.py Wed Jul 25 09:10:46 2018 +0000 @@ -7,7 +7,7 @@ from __future__ import print_function __docformat__ = 'restructuredtext' -import sys, os, types, string, keyword, linecache, tokenize, inspect, cgi +import sys, os, string, keyword, linecache, tokenize, inspect, cgi import pydoc, traceback from roundup.cgi import templating, TranslationService @@ -206,10 +206,9 @@ exception = '<p><strong>%s</strong>: %s' % (str(etype), str(evalue)) attribs = [] - if type(evalue) is types.InstanceType: - for name in dir(evalue): - value = pydoc.html.repr(getattr(evalue, name)) - attribs.append('<br>%s%s = %s' % (indent, name, value)) + for name in dir(evalue): + value = pydoc.html.repr(getattr(evalue, name)) + attribs.append('<br>%s%s = %s' % (indent, name, value)) return head + string.join(attribs) + string.join(traceback) + '<p> </p>'
