summaryrefslogtreecommitdiff
path: root/numpy/linalg/lapack_lite/python_xerbla.c
diff options
context:
space:
mode:
authorUlrich Seidl <Ulrich.Seidl@muneda.com>2014-01-14 15:18:49 +0100
committerJulian Taylor <jtaylor.debian@googlemail.com>2014-01-16 21:47:56 +0100
commit13fbb675daf30be0771085b621b6934064203492 (patch)
treefa5b50bf4dbc26218dc6ce3a5ecbe94af6cfb47f /numpy/linalg/lapack_lite/python_xerbla.c
parent7f46687865db7b88c285ea12ccef43f4b7026a0d (diff)
downloadnumpy-13fbb675daf30be0771085b621b6934064203492.tar.gz
BUG: fix build with single-threaded python
Some symbols are not defined leading to: ImportError Undefined symbol: PyGILState_Release Closes gh-3255
Diffstat (limited to 'numpy/linalg/lapack_lite/python_xerbla.c')
-rw-r--r--numpy/linalg/lapack_lite/python_xerbla.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/numpy/linalg/lapack_lite/python_xerbla.c b/numpy/linalg/lapack_lite/python_xerbla.c
index bc5d41f58..2296cc53f 100644
--- a/numpy/linalg/lapack_lite/python_xerbla.c
+++ b/numpy/linalg/lapack_lite/python_xerbla.c
@@ -26,16 +26,22 @@ int xerbla_(char *srname, integer *info)
6 for name, 4 for param. num. */
int len = 0; /* length of subroutine name*/
+#ifdef WITH_THREAD
PyGILState_STATE save;
+#endif
while( len<6 && srname[len]!='\0' )
len++;
while( len && srname[len-1]==' ' )
len--;
-
- PyOS_snprintf(buf, sizeof(buf), format, len, srname, *info);
+#ifdef WITH_THREAD
save = PyGILState_Ensure();
+#endif
+ PyOS_snprintf(buf, sizeof(buf), format, len, srname, *info);
PyErr_SetString(PyExc_ValueError, buf);
+#ifdef WITH_THREAD
PyGILState_Release(save);
+#endif
+
return 0;
}