This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rgbecker
Recipients
Date 2004-10-14.22:23:50
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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>
History
Date User Action Args
2007-08-23 14:26:42adminlinkissue1047397 messages
2007-08-23 14:26:42admincreate