classification
Title: cgitb failures
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.3, Python 3.2, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, jhylton, rgbecker, wam
Priority: normal Keywords: easy, patch

Created on 2004-10-14 22:23 by rgbecker, last changed 2011-11-19 14:00 by ezio.melotti.

Files
File name Uploaded Description Edit
cgitbbug.py rgbecker, 2004-10-14 22:23 Trivial exciter for the problems
bugfix000.patch rgbecker, 2004-10-14 23:33 Patch against 2.4a3 to fix 1047397
terror.py rgbecker, 2004-11-07 12:11 erroring value and usage
bugfix001.patch rgbecker, 2004-11-07 14:01 bugfix000.patch forgot </em> in a message
bugfix002.patch rgbecker, 2004-11-07 14:04 -4 lines, but more complex patch same end
Messages (5)
msg22695 - (view) Author: Robin Becker (rgbecker) Date: 2004-10-14 22:23
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>
msg22696 - (view) Author: Robin Becker (rgbecker) Date: 2004-10-14 23:33
Logged In: YES 
user_id=6946

Bug fix added
msg22697 - (view) Author: Jeremy Hylton (jhylton) Date: 2004-11-07 14:32
Logged In: YES 
user_id=31392

The formatting of this patch is wrong.  There is a long line
(>80 chars) and missing whitespace around commas, operators,
etc.
msg82098 - (view) Author: Daniel Diniz (ajaksu2) Date: 2009-02-14 18:20
Confirmed on trunk.
msg114382 - (view) Author: Mark Lawrence (BreamoreBoy) Date: 2010-08-19 17:39
Anyone interested in running with this as it's still a problem in all versions?
History
Date User Action Args
2011-11-19 14:00:44ezio.melottisetnosy: - BreamoreBoy

versions: + Python 3.3, - Python 3.1
2010-08-19 17:39:28BreamoreBoysetversions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6
nosy: + BreamoreBoy

messages: + msg114382

stage: test needed -> patch review
2010-08-02 04:03:32wamsetnosy: + wam
2009-02-14 18:20:02ajaksu2setversions: + Python 2.6, - Python 2.4
nosy: + ajaksu2
messages: + msg82098
keywords: + patch, easy
type: behavior
stage: test needed
2004-10-14 22:23:50rgbeckercreate