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
13022f1b
Commit
13022f1b
authored
Jul 03, 2016
by
Ivan Smirnov
Browse files
Bugfix: pass struct size as itemsize to descriptor
Without this, partially bound structs will have incorrect itemsize.
parent
eeb4c043
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
include/pybind11/numpy.h
include/pybind11/numpy.h
+1
-0
No files found.
include/pybind11/numpy.h
View file @
13022f1b
...
@@ -266,6 +266,7 @@ struct npy_format_descriptor<T, typename std::enable_if<is_pod_struct<T>::value>
...
@@ -266,6 +266,7 @@ struct npy_format_descriptor<T, typename std::enable_if<is_pod_struct<T>::value>
args
[
"names"
]
=
names
;
args
[
"names"
]
=
names
;
args
[
"offsets"
]
=
offsets
;
args
[
"offsets"
]
=
offsets
;
args
[
"formats"
]
=
formats
;
args
[
"formats"
]
=
formats
;
args
[
"itemsize"
]
=
int_
(
sizeof
(
T
));
// This is essentially the same as calling np.dtype() constructor in Python and passing
// This is essentially the same as calling np.dtype() constructor in Python and passing
// it a dict of the form {'names': ..., 'formats': ..., 'offsets': ...}.
// it a dict of the form {'names': ..., 'formats': ..., 'offsets': ...}.
if
(
!
api
.
PyArray_DescrConverter_
(
args
.
release
().
ptr
(),
&
dtype_
())
||
!
dtype_
())
if
(
!
api
.
PyArray_DescrConverter_
(
args
.
release
().
ptr
(),
&
dtype_
())
||
!
dtype_
())
...
...
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