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
a3861b54
Commit
a3861b54
authored
Feb 23, 2016
by
Wenzel Jakob
Browse files
type_caster_generic::load(): accept Py_None as input
parent
cf2b87aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
include/pybind11/cast.h
include/pybind11/cast.h
+4
-1
No files found.
include/pybind11/cast.h
View file @
a3861b54
...
@@ -102,7 +102,10 @@ public:
...
@@ -102,7 +102,10 @@ public:
PYBIND11_NOINLINE
bool
load
(
handle
src
,
bool
convert
)
{
PYBIND11_NOINLINE
bool
load
(
handle
src
,
bool
convert
)
{
if
(
!
src
||
!
typeinfo
)
if
(
!
src
||
!
typeinfo
)
return
false
;
return
false
;
if
(
PyType_IsSubtype
(
Py_TYPE
(
src
.
ptr
()),
typeinfo
->
type
))
{
if
(
src
.
ptr
()
==
Py_None
)
{
value
=
nullptr
;
return
true
;
}
else
if
(
PyType_IsSubtype
(
Py_TYPE
(
src
.
ptr
()),
typeinfo
->
type
))
{
value
=
((
instance
<
void
>
*
)
src
.
ptr
())
->
value
;
value
=
((
instance
<
void
>
*
)
src
.
ptr
())
->
value
;
return
true
;
return
true
;
}
}
...
...
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