Skip to content

Commit

Permalink
Update pybind11, remove evil hack
Browse files Browse the repository at this point in the history
  • Loading branch information
mhochsteger committed Dec 3, 2018
1 parent 7934a34 commit 63b7719
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
23 changes: 0 additions & 23 deletions libsrc/general/ngpython.hpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
#ifdef NG_PYTHON

// BEGIN EVIL HACK: Patch PyThread_get_key_value/PyThread_tss_get inside pybind11 to avoid deadlocks
// see https://github.com/pybind/pybind11/pull/1211 (please merge!)
#if defined(__GNUG__) && !defined(__clang__)
# pragma GCC diagnostic ignored "-Wattributes"
#endif
#include <Python.h>
#include <pythread.h>
#include <pybind11/cast.h>
#undef PYBIND11_TLS_GET_VALUE
#if PY_VERSION_HEX >= 0x03070000
inline void * PYBIND11_TLS_GET_VALUE(Py_tss_t *state) {
PyThreadState *tstate = (PyThreadState *) PyThread_tss_get(state);
if (!tstate) tstate = PyGILState_GetThisThreadState();
return tstate;
}
#else
inline void * PYBIND11_TLS_GET_VALUE(int state) {
PyThreadState *tstate = (PyThreadState *) PyThread_get_key_value(state);
if (!tstate) tstate = PyGILState_GetThisThreadState();
return tstate;
}
#endif
// END EVIL HACK
#include <pybind11/pybind11.h>
#include <pybind11/operators.h>
#include <pybind11/numpy.h>
Expand Down

0 comments on commit 63b7719

Please sign in to comment.