Skip to content

"Casting" to a non-matching interface fails with a SystemError or generic name #2007

Open
@filmor

Description

@filmor

Environment

  • Pythonnet version: 3.0.1
  • Python version: any
  • Operating System: any
  • .NET Runtime: any

Details

import clr
from System.Collections.Generic import List, IList, IEnumerable

l = List[str]()
IList[int](l)

# Fails with
# -> TypeError: object does not implement IList`1
# Should be
# -> TypeError: object of type List<String> does not implement IList<Int32>

IList[int](IEnumerable[str](l))
# Fails with
# -> SystemError: error return without exception set

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions