Skip to content

compilation fails with cpython master due to removed function #1932

Description

@tacaswell

Issue description

Use with cpython master branch (of scipy) fails with

  creating build/temp.linux-x86_64-3.9/scipy/fft/_pocketfft
    compile options: '-DPOCKETFFT_PTHREADS -I/home/tcaswell/.virtualenvs/bleeding/include/site/python3.9 -I/home/tcaswell/.virtualenvs/bleeding/include -I/home/tcaswell/.pybuild/bleeding/include/python3.9 -c'
    extra options: '-std=c++14 -fvisibility=hidden'
    g++: scipy/fft/_pocketfft/pypocketfft.cxx
    In file included from scipy/fft/_pocketfft/pypocketfft.cxx:15:
    /home/tcaswell/.virtualenvs/bleeding/include/site/python3.9/pybind11/pybind11.h: In member function ‘void pybind11::gil_scoped_acquire::dec_r
    /home/tcaswell/.virtualenvs/bleeding/include/site/python3.9/pybind11/pybind11.h:1953:13: error: ‘PyThreadState_DeleteCurrent’ was not declare
     1953 |             PyThreadState_DeleteCurrent();
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          |             PyThreadState_Delete
    error: Command "g++ -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPOCKETFFT_PTHREADS -I/home/tcaswell/.virthon3.9/site-packages/numpy/core/include -I/home/tcaswell/.virtualenvs/bleeding/include -I/home/tcaswell/.pybuild/bleeding/include/python3.9 -c s/_pocketfft/pypocketfft.o.d -std=c++14 -fvisibility=hidden" failed with exit status 1

This is due to cpython removing this function for py3.9 : python/cpython#15315 / https://bugs.python.org/issue37878

This function is used at

PYBIND11_NOINLINE void dec_ref() {
--tstate->gilstate_counter;
#if !defined(NDEBUG)
if (detail::get_thread_state_unchecked() != tstate)
pybind11_fail("scoped_acquire::dec_ref(): thread state must be current!");
if (tstate->gilstate_counter < 0)
pybind11_fail("scoped_acquire::dec_ref(): reference count underflow!");
#endif
if (tstate->gilstate_counter == 0) {
#if !defined(NDEBUG)
if (!release)
pybind11_fail("scoped_acquire::dec_ref(): internal error!");
#endif
PyThreadState_Clear(tstate);
PyThreadState_DeleteCurrent();
PYBIND11_TLS_DELETE_VALUE(detail::get_internals().tstate);
release = false;
}
}

Reproducible example code

Trying to install scipy from source with cpython master.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions