Bugs item #1531405, was opened at 2006-07-30 14:06
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1531405&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 9
Submitted By: Jp Calderone (kuran)
Assigned to: Neal Norwitz (nnorwitz)
Summary: format_exception raises if str(exception) raises

Initial Comment:
Previously format_exception_only used _some_str() to
find the string representation of an exception.  In
current [EMAIL PROTECTED] that code has been factored into
_format_final_exc_line and changed in two ways: it now
calls str(exception) twice instead of once and in one
of those cases, it calls str() directly rather than
through _some_str, which does exception handling.

The end result of this is that application-level code
which uses the traceback module to format exceptions
which previously could not raise exceptions now can
raise exceptions.


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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-08-03 21:50

Message:
Logged In: YES 
user_id=33168

Committed revision 51079.


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

Comment By: Georg Brandl (gbrandl)
Date: 2006-08-02 23:13

Message:
Logged In: YES 
user_id=849994

I have a fix and will apply as soon as trunk is unfrozen.

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

Comment By: Jp Calderone (kuran)
Date: 2006-08-02 15:55

Message:
Logged In: YES 
user_id=366566

I don't think those are related.  To clarify, this is the
case I am talking about:

Python 2.5b2 (trunk:50989, Jul 30 2006, 15:42:25) 
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> class X:
...     def __str__(self): 1/0
... 
>>> import traceback
>>> traceback.format_exception_only(X, X())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/home/exarkun/Projects/python/trunk/Lib/traceback.py", line
179, in format_exception_only
    return [_format_final_exc_line(stype, value)]
  File
"/home/exarkun/Projects/python/trunk/Lib/traceback.py", line
205, in _format_final_exc_line
    if value is None or not str(value):
  File "<stdin>", line 2, in __str__
ZeroDivisionError: integer division or modulo by zero
>>> 

Compare this to the Python 2.4 output:

Python 2.4.3 (#2, Apr 27 2006, 14:43:58) 
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> class X:
...      def __str__(self): 1/0
... 
>>> import traceback
>>> traceback.format_exception_only(X, X())
['X: <unprintable instance object>\n']
>>> 


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

Comment By: Jim Jewett (jimjjewett)
Date: 2006-08-02 15:13

Message:
Logged In: YES 
user_id=764593

Jp -- is this the same issue as 1515163 (patch 1515343)?  
If so, it should be cleared up in the traceback.py from 
head.  Could you doublecheck?



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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1531405&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to