[Python-bugs-list] [ python-Bugs-610610 ] Exception.__str__ error problems

noreply@sourceforge.net noreply@sourceforge.net
Tue, 17 Sep 2002 08:23:02 -0700


Bugs item #610610, was opened at 2002-09-17 17:23
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=610610&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Martijn Pieters (mjpieters)
Assigned to: Nobody/Anonymous (nobody)
Summary: Exception.__str__ error problems

Initial Comment:
Exception.__str__ seems to contain a bug that causes it
to not handle errors correctly. To reproduce the
problem, type the following lines into a Python
interpreter:

  ex = Exception()
  ex.args = None
  str(ex)
  d = {}

Note that we set Exception.args to None, while the
__str__ method expects args to be a sequence. The
interpreter, however, prints "'None'", and no error is
shown. But when trying to excecute the perfectly
harmless 'd = {}' assignment, an error, with *no
traceback* is printed an 'd' is never defined.

I have not been able to recreate this bug in a simple
script yet, though it was found through a large Zope
application where a client had created a custom
Exception with self.args set to None. The above
behaviour has been observed in Python versions 2.1.3,
2.2.1 and current CVS, but not in Python 1.5.2.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=610610&group_id=5470