Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
b38ca22e
Commit
b38ca22e
authored
Jun 29, 2016
by
Ivan Smirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a few braces for clarity
parent
95545e62
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
include/pybind11/numpy.h
+4
-2
No files found.
include/pybind11/numpy.h
View file @
b38ca22e
...
...
@@ -257,12 +257,14 @@ struct npy_format_descriptor<T, typename std::enable_if<is_pod_struct<T>::value>
pybind11_fail
(
"NumPy: failed to create structured dtype"
);
auto
np
=
module
::
import
(
"numpy"
);
auto
empty
=
(
object
)
np
.
attr
(
"empty"
);
if
(
auto
arr
=
(
object
)
empty
(
int_
(
0
),
dtype
()))
if
(
auto
view
=
PyMemoryView_FromObject
(
arr
.
ptr
()))
if
(
auto
arr
=
(
object
)
empty
(
int_
(
0
),
dtype
()))
{
if
(
auto
view
=
PyMemoryView_FromObject
(
arr
.
ptr
()))
{
if
(
auto
info
=
PyMemoryView_GET_BUFFER
(
view
))
{
std
::
strncpy
(
format_
(),
info
->
format
,
4096
);
return
;
}
}
}
pybind11_fail
(
"NumPy: failed to extract buffer format"
);
}
...
...
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