File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change 1919
2020#ifndef FORCE_IMPORT_ARRAY
2121#define NO_IMPORT_ARRAY
22- static int _import_array () { return 0 ; };
2322#endif
2423#ifndef PY_ARRAY_UNIQUE_SYMBOL
2524#define PY_ARRAY_UNIQUE_SYMBOL xtensor_python_ARRAY_API
@@ -33,17 +32,7 @@ static int _import_array() { return 0; };
3332namespace xt
3433{
3534
36- /* *
37- * Import the numpy Python module.
38- */
39- inline void import_numpy ()
40- {
41- if (_import_array () < 0 )
42- {
43- PyErr_Print ();
44- PyErr_SetString (PyExc_ImportError, " numpy.core.multiarray failed to import" );
45- }
46- }
35+ inline void import_numpy ();
4736
4837 /* *
4938 * @class pycontainer
@@ -253,6 +242,19 @@ namespace xt
253242 *static_cast <derived_type*>(this ) = std::move (tmp);
254243 }
255244
245+ /* *
246+ * Import the numpy Python module.
247+ */
248+ inline void import_numpy ()
249+ {
250+ #ifdef FORCE_IMPORT_ARRAY
251+ if (_import_array () < 0 )
252+ {
253+ PyErr_Print ();
254+ PyErr_SetString (PyExc_ImportError, " numpy.core.multiarray failed to import" );
255+ }
256+ #endif
257+ }
256258}
257259
258260#endif
You can’t perform that action at this time.
0 commit comments