Fix typecheck typemaps for non-pointers and NULL
The typecheck typemaps succeed for non pointers (SWIGTYPE, SWIGTYPE&, SWIGTYPE&&) when the equivalent to C NULL is passed from the target language. This commit implements a fix for Python to not accept a Python None for non-pointer types. Issue #1202
This commit is contained in:
parent
315c7dab06
commit
3efea1f4ab
4 changed files with 11 additions and 18 deletions
|
|
@ -13,15 +13,7 @@ check(1, A(1).get())
|
|||
check(2, A(1.0).get())
|
||||
check(3, A(B()).get())
|
||||
check(4, A("hello").get())
|
||||
try:
|
||||
check(3, A(None).get())
|
||||
raise RuntimeError
|
||||
except ValueError:
|
||||
# ValueError: invalid null reference in method 'new_A', argument 1 of type 'B const &'
|
||||
# Arguably A(char *) should be chosen, but there is a bug to do with None passed to methods overloaded by value,
|
||||
# references and pointers to different types, where pointers ought to be
|
||||
# given a slightly higher precedence.
|
||||
pass
|
||||
check(4, A(None).get())
|
||||
|
||||
check(1, get(1))
|
||||
check(2, get(1.0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue