| 4494 | |
| 4495 | |
| 4496 | static PyObject * |
| 4497 | _reload_guard(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args)) { |
| 4498 | static int initialized = 0; |
| 4499 | |
| 4500 | #if !defined(PYPY_VERSION) |
| 4501 | if (PyThreadState_Get()->interp != PyInterpreterState_Main()) { |
| 4502 | if (PyErr_WarnEx(PyExc_UserWarning, |
| 4503 | "NumPy was imported from a Python sub-interpreter but " |
| 4504 | "NumPy does not properly support sub-interpreters. " |
| 4505 | "This will likely work for most users but might cause hard to " |
| 4506 | "track down issues or subtle bugs. " |
| 4507 | "A common user of the rare sub-interpreter feature is wsgi " |
| 4508 | "which also allows single-interpreter mode.\n" |
| 4509 | "Improvements in the case of bugs are welcome, but is not " |
| 4510 | "on the NumPy roadmap, and full support may require " |
| 4511 | "significant effort to achieve.", 2) < 0) { |
| 4512 | return NULL; |
| 4513 | } |
| 4514 | /* No need to give the other warning in a sub-interpreter as well... */ |
| 4515 | initialized = 1; |
| 4516 | Py_RETURN_NONE; |
| 4517 | } |
| 4518 | #endif |
| 4519 | if (initialized) { |
| 4520 | if (PyErr_WarnEx(PyExc_UserWarning, |
| 4521 | "The NumPy module was reloaded (imported a second time). " |
| 4522 | "This can in some cases result in small but subtle issues " |
| 4523 | "and is discouraged.", 2) < 0) { |
| 4524 | return NULL; |
| 4525 | } |
| 4526 | } |
| 4527 | initialized = 1; |
| 4528 | Py_RETURN_NONE; |
| 4529 | } |
| 4530 | |
| 4531 | |
| 4532 | static PyObject * |
nothing calls this directly
no outgoing calls
no test coverage detected