FIX: support python311 by tacaswell · Pull Request #3762 · pybind/pybind11 · GitHub
Skip to content

FIX: support python311 - #3762

Closed
tacaswell wants to merge 2 commits into
pybind:masterfrom
tacaswell:fix_py311
Closed

tacaswell wants to merge 2 commits into
pybind:masterfrom
tacaswell:fix_py311

Conversation

@tacaswell

Copy link
Copy Markdown

In 18b5dd68c6b616257ae243c0b6bb965ffc885a23 / python/cpython#31530 / https://bugs.python.org/issue46836 the _frame struct was moved to an internal header, however the public API is primarily read-only.

I am not sure that this is the correct fix, but it gets scipy to compile again!

Description

Suggested changelog entry:

FIX: include internal CPython hearders

tacaswell and others added 2 commits February 26, 2022 19:51
In 18b5dd68c6b616257ae243c0b6bb965ffc885a23 /
python/cpython#31530 /
https://bugs.python.org/issue46836

the _frame struct was moved to an internal header, however the public API is
primarily read-only.
@Skylion007 Skylion007 added the python dev Working on development versions of Python label Feb 27, 2022
@Skylion007

Skylion007 commented Feb 27, 2022

Copy link
Copy Markdown
Collaborator

@Skylion007 Skylion007 closed this Feb 27, 2022
@Skylion007 Skylion007 reopened this Feb 27, 2022
@Skylion007

Copy link
Copy Markdown
Collaborator

@tacaswell Can you paste the full error if this include is missing? I suspect it's just from f_back in error_string() that we need to make use the new API?

@tacaswell

Copy link
Copy Markdown
Author
  creating build/temp.linux-x86_64-3.11/scipy/fft/_pocketfft
  INFO: compile options: '-DPOCKETFFT_PTHREADS -I/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include -I/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include -I/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.11/numpy/distutils/include -I/home/tcaswell/.virtualenvs/bleeding/include -I/home/tcaswell/.pybuild/bleeding/include/python3.11 -c'
  extra options: '-std=c++14 -pthread -fvisibility=hidden -msse -msse2 -msse3'
  INFO: g++: scipy/fft/_pocketfft/pypocketfft.cxx
  In file included from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../cast.h:15,
                   from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../attr.h:13,
                   from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/class.h:12,
                   from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/pybind11.h:13,
                   from scipy/fft/_pocketfft/pypocketfft.cxx:15:
  /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../detail/type_caster_base.h: In function ‘std::string pybind11::detail::error_string()’:
  /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../detail/type_caster_base.h:517:26: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
    517 |             frame = frame->f_back;
        |                          ^~
  In file included from /home/tcaswell/.pybuild/bleeding/include/python3.11/Python.h:42,
                   from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../detail/common.h:211,
                   from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../cast.h:13,
                   from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../attr.h:13,
                   from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/class.h:12,
                   from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/pybind11.h:13,
                   from scipy/fft/_pocketfft/pypocketfft.cxx:15:
  /home/tcaswell/.pybuild/bleeding/include/python3.11/pytypedefs.h:21:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
     21 | typedef struct _frame PyFrameObject;
        |                ^~~~~~
  error: Command "g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPOCKETFFT_PTHREADS -I/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include -I/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include -I/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.11/numpy/distutils/include -I/home/tcaswell/.virtualenvs/bleeding/include -I/home/tcaswell/.pybuild/bleeding/include/python3.11 -c scipy/fft/_pocketfft/pypocketfft.cxx -o build/temp.linux-x86_64-3.11/scipy/fft/_pocketfft/pypocketfft.o -MMD -MF build/temp.linux-x86_64-3.11/scipy/fft/_pocketfft/pypocketfft.o.d -std=c++14 -pthread -fvisibility=hidden -msse -msse2 -msse3" failed with exit status 1

Re-running just the g++ gives

$ g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPOCKETFFT_PTHREADS -I/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include -I/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include -I/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.11/nump
y/distutils/include -I/home/tcaswell/.virtualenvs/bleeding/include -I/home/tcaswell/.pybuild/bleeding/include/python3.11 -c scipy/fft/_pocketfft/pypocketfft.cxx -o build/temp.linux-x86_64-3.11/scipy/fft/_pocketfft/pypocketfft.o -MMD -MF build/temp.linux-x86_64-3.11/scipy/fft/_pocketfft/pypocketfft.o.d -std=c++14 -pthread -fvisibility=hidden -msse -msse2 -msse3
In file included from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../cast.h:15,
                 from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../attr.h:13,
                 from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/class.h:12,
                 from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/pybind11.h:13,
                 from scipy/fft/_pocketfft/pypocketfft.cxx:15:
/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../detail/type_caster_base.h: In function ‘std::string pybind11::detail::error_string()’:
/home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../detail/type_caster_base.h:517:26: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
  517 |             frame = frame->f_back;
      |                          ^~
In file included from /home/tcaswell/.pybuild/bleeding/include/python3.11/Python.h:42,
                 from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../detail/common.h:211,
                 from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../cast.h:13,
                 from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/../attr.h:13,
                 from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/detail/class.h:12,
                 from /home/tcaswell/.virtualenvs/bleeding/lib/python3.11/site-packages/pybind11/include/pybind11/pybind11.h:13,
                 from scipy/fft/_pocketfft/pypocketfft.cxx:15:
/home/tcaswell/.pybuild/bleeding/include/python3.11/pytypedefs.h:21:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
   21 | typedef struct _frame PyFrameObject;
      |                ^~~~~~

so I think this is the relevant part of the log.

@Skylion007

Copy link
Copy Markdown
Collaborator

@tacaswell I have added the proper changes to #3694. Can you verify that this solves the issue?

@tacaswell

Copy link
Copy Markdown
Author

@tacaswell tacaswell closed this Feb 28, 2022
@tacaswell
tacaswell deleted the fix_py311 branch February 28, 2022 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python dev Working on development versions of Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants