| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6fe5cf9 commit ab133d8
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,6 @@ | |||
| 19 | 19 | ||
| 20 | 20 | #ifndef FORCE_IMPORT_ARRAY | |
| 21 | 21 | #define NO_IMPORT_ARRAY | |
| 22 | - static int _import_array() { return 0; }; | ||
| 23 | 22 | #endif | |
| 24 | 23 | #ifndef PY_ARRAY_UNIQUE_SYMBOL | |
| 25 | 24 | #define PY_ARRAY_UNIQUE_SYMBOL xtensor_python_ARRAY_API | |
@@ -33,17 +32,7 @@ static int _import_array() { return 0; }; | |||
| 33 | 32 | namespace xt | |
| 34 | 33 | { | |
| 35 | 34 | ||
| 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(); | ||
| 47 | 36 | ||
| 48 | 37 | /** | |
| 49 | 38 | * @class pycontainer | |
@@ -253,6 +242,19 @@ namespace xt | |||
| 253 | 242 | *static_cast<derived_type*>(this) = std::move(tmp); | |
| 254 | 243 | } | |
| 255 | 244 | ||
| 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 | + } | ||
| 256 | 258 | } | |
| 257 | 259 | ||
| 258 | 260 | #endif | |
| Back | FazBrowse Home | New Git URL |
0 commit comments