classification
Title: Add 'unexpected_type' to TypeError
Type: enhancement Stage: test needed
Components: Interpreter Core Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: barry, brett.cannon, ezio.melotti
Priority: normal Keywords:

Created on 2013-06-07 20:55 by brett.cannon, last changed 2013-06-15 21:06 by ezio.melotti.

Messages (1)
msg190780 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-06-07 20:55
TypeError could grow an 'unexpected_type' attribute to store the type of the argument that was used to trigger the exception. Since types are expected to not be deleted there is no GC worry.

Having an 'expected' attribute makes no sense in the face of a union of types, etc. (unless the assumption of a frozenset is made for the attribute). Plus exceptions typically do not contain info on what would have been acceptable (although in this instance it may make sense).
History
Date User Action Args
2013-06-15 21:06:07ezio.melottisetnosy: + ezio.melotti
2013-06-07 21:24:11barrysetnosy: + barry
2013-06-07 20:55:26brett.cannoncreate