Message22695
cgitb fails when evaluating various reprs/getattrs. The bug
demonstrator is cgitbbug.py. Below is the run output
for two bugs. Fixes are possible by putting try: except
around various evaluations. Although the test is
artificial we found these could happen in real code.
This is with 2.4a3 Windows XP
Sample output
C:\Python24>.\python \tmp\cgitbbug.py repr1
2.4a3 (#56, Sep 2 2004, 20:50:21) [MSC v.1310 32 bit
(Intel)]
Traceback (most recent call last):
File "\tmp\cgitbbug.py", line 36, in ?
print cgitb.html(sys.exc_info(),context=3)
File "C:\python24\lib\cgitb.py", line 155, in html
dump.append('%s = %s' % (name,
pydoc.html.repr(value)))
File "C:\python24\lib\pydoc.py", line 352, in repr
return Repr.repr(self, object)
File "C:\python24\lib\repr.py", line 24, in repr
return self.repr1(x, self.maxlevel)
File "C:\python24\lib\pydoc.py", line 359, in repr1
return self.escape(cram(stripid(repr(x)),
self.maxother))
File "\tmp\cgitbbug.py", line 12, in __repr__
if self._mad=='repr1': raise ValueError('repr1
madness')
ValueError: repr1 madness
C:\Python24>.\python \tmp\cgitbbug.py getattr1
2.4a3 (#56, Sep 2 2004, 20:50:21) [MSC v.1310 32 bit
(Intel)]
Traceback (most recent call last):
File "\tmp\cgitbbug.py", line 36, in ?
print cgitb.html(sys.exc_info(),context=3)
File "C:\python24\lib\cgitb.py", line 129, in html
vars = scanvars(reader, frame, locals)
File "C:\python24\lib\cgitb.py", line 83, in scanvars
value = getattr(parent, token, __UNDEF__)
File "\tmp\cgitbbug.py", line 16, in __getattr__
if self._mad=='getattr1': raise
ValueError('getattr1 madness')
ValueError: getattr1 madness
C:\Python24> |
|
Date |
User |
Action |
Args |
2007-08-23 14:26:42 | admin | link | issue1047397 messages |
2007-08-23 14:26:42 | admin | create | |
|