main
main copied to clipboard
Raise should throw typeError if Type and Value mismatch
raise ValueError(1), "foo"
should throw a type error since the type is an instance and the value can't be
converted to the type.
This is excercised by the CPython2.5 test test_generators.py usage of
Generator.Throw().
From 6.9 in the docs: http://docs.python.org/ref/raise.html
"If the first object is an instance, the type of the exception is the class of
the instance, the instance itself is the value, and the second object must be
None. "
In C2.5:
raise ValueError(1), "foo"
Traceback (most recent call last):
File "", line 1, in
TypeError: instance exception may not have a separate value
In IPY:
raise ValueError(1), "foo"
Traceback (most recent call last):
File , line 0, in raise ValueError(1), foo_##24
ValueError: 1
Work Item Details
Original CodePlex Issue: Issue 23859 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Jul 28, 2009 at 12:02 AM Reported by: dfugate Updated on: Feb 22, 2013 at 2:12 AM Updated by: jdhardy Custom value: Reported internally at Microsoft. CreatedDate: 12/10/2007 NewInternalID: 409673 OldInternalID: 359566 AreaPath: IronPython\Python25