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
ea2755cc
Commit
ea2755cc
authored
Jun 19, 2016
by
Ivan Smirnov
Browse files
Use a macro for numpy API definitions
parent
f7143dc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
include/pybind11/numpy.h
include/pybind11/numpy.h
+7
-5
No files found.
include/pybind11/numpy.h
View file @
ea2755cc
...
...
@@ -55,11 +55,13 @@ public:
void
**
api_ptr
=
(
void
**
)
(
c
?
PyCObject_AsVoidPtr
(
c
.
ptr
())
:
nullptr
);
#endif
API
api
;
api
.
PyArray_Type_
=
(
decltype
(
api
.
PyArray_Type_
))
api_ptr
[
API_PyArray_Type
];
api
.
PyArray_DescrFromType_
=
(
decltype
(
api
.
PyArray_DescrFromType_
))
api_ptr
[
API_PyArray_DescrFromType
];
api
.
PyArray_FromAny_
=
(
decltype
(
api
.
PyArray_FromAny_
))
api_ptr
[
API_PyArray_FromAny
];
api
.
PyArray_NewCopy_
=
(
decltype
(
api
.
PyArray_NewCopy_
))
api_ptr
[
API_PyArray_NewCopy
];
api
.
PyArray_NewFromDescr_
=
(
decltype
(
api
.
PyArray_NewFromDescr_
))
api_ptr
[
API_PyArray_NewFromDescr
];
#define DECL_NPY_API(Func) api.Func##_ = (decltype(api.Func##_)) api_ptr[API_##Func];
DECL_NPY_API
(
PyArray_Type
);
DECL_NPY_API
(
PyArray_DescrFromType
);
DECL_NPY_API
(
PyArray_FromAny
);
DECL_NPY_API
(
PyArray_NewCopy
);
DECL_NPY_API
(
PyArray_NewFromDescr
);
#undef DECL_NPY_API
return
api
;
}
...
...
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