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
076b953c
Commit
076b953c
authored
Jul 17, 2016
by
Ivan Smirnov
Browse files
Restore dtype equivalence sanity check
parent
8f2f7cd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
include/pybind11/numpy.h
include/pybind11/numpy.h
+3
-5
No files found.
include/pybind11/numpy.h
View file @
076b953c
...
...
@@ -342,11 +342,9 @@ struct npy_format_descriptor<T, typename std::enable_if<is_pod_struct<T>::value>
// Sanity check: verify that NumPy properly parses our buffer format string
auto
arr
=
array
(
buffer_info
(
nullptr
,
sizeof
(
T
),
format
(),
1
,
{
0
},
{
sizeof
(
T
)
}));
auto
dtype
=
(
object
)
arr
.
attr
(
"dtype"
);
auto
fixed_dtype
=
dtype
;
// auto fixed_dtype = array::strip_padding_fields(object(dtype_(), true));
// if (!api.PyArray_EquivTypes_(dtype_(), fixed_dtype.ptr()))
// pybind11_fail("NumPy: invalid buffer descriptor!");
auto
fixed_dtype
=
array
::
strip_padding_fields
(
object
(
dtype_
(),
true
));
if
(
!
api
.
PyArray_EquivTypes_
(
dtype_
(),
fixed_dtype
.
ptr
()))
pybind11_fail
(
"NumPy: invalid buffer descriptor!"
);
}
private:
...
...
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