compilation fixes

This commit is contained in:
Wenzel Jakob 2016-04-25 04:00:47 +02:00
parent 39e97e6a49
commit 084ca0e553
2 changed files with 2 additions and 6 deletions

View File

@ -128,10 +128,6 @@
} \ } \
PyObject *pybind11_init() PyObject *pybind11_init()
extern "C" {
extern PyThreadState *_PyThreadState_Current;
};
NAMESPACE_BEGIN(pybind11) NAMESPACE_BEGIN(pybind11)
typedef Py_ssize_t ssize_t; typedef Py_ssize_t ssize_t;

View File

@ -1070,7 +1070,7 @@ public:
tstate->gilstate_counter = 0; tstate->gilstate_counter = 0;
PyThread_set_key_value(internals.tstate, tstate); PyThread_set_key_value(internals.tstate, tstate);
} else { } else {
release = _PyThreadState_Current != tstate; release = PyThreadState_GET() != tstate;
} }
if (release) { if (release) {
@ -1091,7 +1091,7 @@ public:
void dec_ref() { void dec_ref() {
--tstate->gilstate_counter; --tstate->gilstate_counter;
#if !defined(NDEBUG) #if !defined(NDEBUG)
if (_PyThreadState_Current != tstate) if (PyThreadState_GET() != tstate)
pybind11_fail("scoped_acquire::dec_ref(): thread state must be current!"); pybind11_fail("scoped_acquire::dec_ref(): thread state must be current!");
if (tstate->gilstate_counter < 0) if (tstate->gilstate_counter < 0)
pybind11_fail("scoped_acquire::dec_ref(): reference count underflow!"); pybind11_fail("scoped_acquire::dec_ref(): reference count underflow!");