Skip to content
This repository was archived by the owner on Sep 14, 2018. It is now read-only.
This repository was archived by the owner on Sep 14, 2018. It is now read-only.

Raise should throw typeError if Type and Value mismatch #604

@ironpythonbot

Description

@ironpythonbot

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions