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 ncoghlan
Recipients benjamin.peterson, eric.snow, ncoghlan, r.david.murray
Date 2011-07-12.07:28:55
SpamBayes Score 1.1628166e-09
Marked as misclassified No
Message-id <1310455736.37.0.858077918313.issue12535@psf.upfronthosting.co.za>
In-reply-to
Content
The ordering is as it is so that the last line in the displayed traceback corresponds to the exception that was actually caught. That is, the last line remains the same regardless of whether or not there was an earlier exception in the chain. Without that, the caught exception would be buried in the middle of a wall of text:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rdmurray/python/email6/Lib/mailbox.py", line 1631, in set_flags
    self.replace_header('Status', status_flags)
  File "/home/rdmurray/python/email6/Lib/email/message.py", line 495, in replace_header
    print('rep', self.header_factory)
  File "/home/rdmurray/python/email6/Lib/email/message.py", line 469, in __getattr__
    self.__class__.__name__, key))
AttributeError: 'mboxMessage' object has no attribute 'header_factory'
^^^^^^^^^^^^^^^^CAUGHT THIS
This exception was caught while handling:
Traceback (most recent call last):
  File "/home/rdmurray/python/email6/Lib/email/message.py", line 466, in __getattr__
    return getattr(self._headers, key)
AttributeError: '_Header_List' object has no attribute 'header_factory'
^^^^^^^^^^^^^^^^NOT THIS

The consequence is that the outermost call in the call stack ends up buried in the middle of a wall of text instead. That's not optimal either, but we have to choose one or the other and I think the status quo is the better choice.

However, not closing this yet, as I think RDM may have a valid point: should we put something at the *start* of the truncated traceback to indicate that it was cut short due to another exception? For example:

Traceback (truncated due to later exception, most recent call last):
  File "/home/rdmurray/python/email6/Lib/email/message.py", line 466, in __getattr__
    return getattr(self._headers, key)
AttributeError: '_Header_List' object has no attribute 'header_factory'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rdmurray/python/email6/Lib/mailbox.py", line 1631, in set_flags
    self.replace_header('Status', status_flags)
  File "/home/rdmurray/python/email6/Lib/email/message.py", line 495, in replace_header
    print('rep', self.header_factory)
  File "/home/rdmurray/python/email6/Lib/email/message.py", line 469, in __getattr__
    self.__class__.__name__, key))
AttributeError: 'mboxMessage' object has no attribute 'header_factory'
History
Date User Action Args
2011-07-12 07:28:56ncoghlansetrecipients: + ncoghlan, benjamin.peterson, r.david.murray, eric.snow
2011-07-12 07:28:56ncoghlansetmessageid: <1310455736.37.0.858077918313.issue12535@psf.upfronthosting.co.za>
2011-07-12 07:28:55ncoghlanlinkissue12535 messages
2011-07-12 07:28:55ncoghlancreate