Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
52f4c3ae
"tests/test_class_sh_basic.cpp" did not exist on "b3ad3ac43ff1a3813074d394a4cd4ca7c6bf70e5"
Commit
52f4c3ae
authored
Mar 03, 2016
by
Wenzel Jakob
Browse files
handle nullptr arguments with custom holder types (fixes #124)
parent
c769fce2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
include/pybind11/cast.h
include/pybind11/cast.h
+5
-3
No files found.
include/pybind11/cast.h
View file @
52f4c3ae
...
@@ -500,10 +500,12 @@ public:
...
@@ -500,10 +500,12 @@ public:
using
type_caster
<
type
>::
copy_constructor
;
using
type_caster
<
type
>::
copy_constructor
;
bool
load
(
handle
src
,
bool
convert
)
{
bool
load
(
handle
src
,
bool
convert
)
{
if
(
!
src
||
!
typeinfo
)
if
(
!
src
||
!
typeinfo
)
{
return
false
;
return
false
;
}
else
if
(
src
.
ptr
()
==
Py_None
)
{
if
(
PyType_IsSubtype
(
Py_TYPE
(
src
.
ptr
()),
typeinfo
->
type
))
{
value
=
nullptr
;
return
true
;
}
else
if
(
PyType_IsSubtype
(
Py_TYPE
(
src
.
ptr
()),
typeinfo
->
type
))
{
auto
inst
=
(
instance
<
type
,
holder_type
>
*
)
src
.
ptr
();
auto
inst
=
(
instance
<
type
,
holder_type
>
*
)
src
.
ptr
();
value
=
inst
->
value
;
value
=
inst
->
value
;
holder
=
inst
->
holder
;
holder
=
inst
->
holder
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment