New submission from Brett Cannon:

Much like ImportError now has 'name' and 'path', AttributeError should get an 
'attr' attribute that can only be set through a keyword argument or after 
creating an instance. That would make the common ``try/except AttributeError`` 
uses much more robust by not accidentally swallowing an AttributeError that has 
nothing to do with the attribute in question::

 try:
   cls.meth()
 except AttributeError as exc:
   if exc.attr != 'meth':
     raise

----------
components: Interpreter Core
messages: 190754
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: Add an 'attr' attribute to AttributeError
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18156>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to