Bug 2045013 - pythia8 fails to build with Python 3.11: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
Summary: pythia8 fails to build with Python 3.11: 'PyFrameObject' {aka 'struct _frame...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: pythia8
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Mattias Ellert
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2098795 (view as bug list)
Depends On:
Blocks: PYTHON3.11 F37FTBFS F37FailsToInstall
TreeView+ depends on / blocked
 
Reported: 2022-01-25 13:12 UTC by Tomáš Hrnčiar
Modified: 2022-06-21 10:57 UTC (History)
3 users (show)

Fixed In Version: pythia8-8.3.06-5.fc37
Clone Of:
Environment:
Last Closed: 2022-06-21 10:57:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab Pythia8 releases issues 128 0 None None None 2022-01-27 06:33:20 UTC

Description Tomáš Hrnčiar 2022-01-25 13:12:34 UTC
pythia8 fails to build with Python 3.11.0a4.


include/pybind11/cast.h: In function 'std::string pybind11::detail::error_string()':
include/pybind11/cast.h:442:38: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
  442 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                      ^~~~~~
include/pybind11/cast.h:442:75: error: expected primary-expression before '>' token
  442 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                                                           ^
include/pybind11/cast.h:442:77: error: expected primary-expression before ')' token
  442 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                                                             ^
include/pybind11/cast.h:444:31: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
  444 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                               ^~~~~~
include/pybind11/cast.h:444:64: error: expected primary-expression before '>' token
  444 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                                                                ^
include/pybind11/cast.h:444:66: error: expected primary-expression before ')' token
  444 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                                                                  ^
include/pybind11/pybind11.h: In function 'pybind11::function pybind11::get_type_overload(const void*, const detail::type_info*, const char*)':
include/pybind11/pybind11.h:2021:49: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'frame'; did you mean 'cframe'?
 2021 |     PyFrameObject *frame = PyThreadState_Get()->frame;
      |                                                 ^~~~~
      |                                                 cframe
include/pybind11/pybind11.h:2022:43: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2022 |     if (frame && (std::string) str(frame->f_code->co_name) == name &&
      |                                           ^~~~~~
include/pybind11/pybind11.h:2023:16: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2023 |         frame->f_code->co_argcount > 0) {
      |                ^~~~~~
include/pybind11/pybind11.h:2026:20: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_locals'
 2026 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                    ^~~~~~~~
In file included from /usr/include/python3.11/Python.h:35,
                 from include/pybind11/detail/common.h:112,
                 from include/pybind11/pytypes.h:12,
                 from include/pybind11/cast.h:13:
include/pybind11/pybind11.h:2026:54: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2026 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                                                      ^~~~~~
/usr/include/python3.11/tupleobject.h:27:18: note: in expansion of macro 'PyType_FastSubclass'
   27 |                  PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
      |                  ^~~~~~~~~~~~~~~~~~~
/usr/include/python3.11/object.h:140:30: note: in expansion of macro '_PyObject_CAST_CONST'
  140 | #define Py_TYPE(ob) _Py_TYPE(_PyObject_CAST_CONST(ob))
      |                              ^~~~~~~~~~~~~~~~~~~~
/usr/include/python3.11/tupleobject.h:27:38: note: in expansion of macro 'Py_TYPE'
   27 |                  PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
      |                                      ^~~~~~~
/usr/include/python3.11/cpython/tupleobject.h:19:35: note: in expansion of macro 'PyTuple_Check'
   19 | #define _PyTuple_CAST(op) (assert(PyTuple_Check(op)), (PyTupleObject *)(op))
      |                                   ^~~~~~~~~~~~~
/usr/include/python3.11/cpython/tupleobject.h:23:34: note: in expansion of macro '_PyTuple_CAST'
   23 | #define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i])
      |                                  ^~~~~~~~~~~~~
include/pybind11/pybind11.h:2026:30: note: in expansion of macro 'PyTuple_GET_ITEM'
 2026 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                              ^~~~~~~~~~~~~~~~
In file included from /usr/include/python3.11/tupleobject.h:39,
                 from /usr/include/python3.11/Python.h:57:
include/pybind11/pybind11.h:2026:54: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2026 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                                                      ^~~~~~
/usr/include/python3.11/cpython/tupleobject.h:19:73: note: in definition of macro '_PyTuple_CAST'
   19 | #define _PyTuple_CAST(op) (assert(PyTuple_Check(op)), (PyTupleObject *)(op))
      |                                                                         ^~
include/pybind11/pybind11.h:2026:30: note: in expansion of macro 'PyTuple_GET_ITEM'
 2026 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                              ^~~~~~~~~~~~~~~~
make[1]: *** [Makefile:69: tmp-python-3/Basics.o] Error 1
make[1]: Leaving directory '/builddir/build/BUILD/pythia8306/plugins/python'
make[1]: *** Waiting for unfinished jobs....
make[1]: Entering directory '/builddir/build/BUILD/pythia8306/plugins/python'
g++ src/Analysis.cpp -o tmp-python-3/Analysis.o -c -MD -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -std=c++11 -fPIC -DGZIP -Iinclude -I/usr/include/python3.11 -w -fpermissive 
make[1]: Leaving directory '/builddir/build/BUILD/pythia8306/plugins/python'
In file included from include/pybind11/attr.h:13,
                 from include/pybind11/pybind11.h:44,
                 from src/Analysis.cpp:31:
include/pybind11/cast.h: In function 'std::string pybind11::detail::error_string()':
include/pybind11/cast.h:442:38: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
  442 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                      ^~~~~~
include/pybind11/cast.h:442:75: error: expected primary-expression before '>' token
  442 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                                                           ^
include/pybind11/cast.h:442:77: error: expected primary-expression before ')' token
  442 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                                                             ^
include/pybind11/cast.h:444:31: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
  444 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                               ^~~~~~
include/pybind11/cast.h:444:64: error: expected primary-expression before '>' token
  444 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                                                                ^
include/pybind11/cast.h:444:66: error: expected primary-expression before ')' token
  444 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                                                                  ^
include/pybind11/pybind11.h: In function 'pybind11::function pybind11::get_type_overload(const void*, const detail::type_info*, const char*)':
include/pybind11/pybind11.h:2021:49: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'frame'; did you mean 'cframe'?
 2021 |     PyFrameObject *frame = PyThreadState_Get()->frame;
      |                                                 ^~~~~
      |                                                 cframe
include/pybind11/pybind11.h:2022:43: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2022 |     if (frame && (std::string) str(frame->f_code->co_name) == name &&
      |                                           ^~~~~~
include/pybind11/pybind11.h:2023:16: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2023 |         frame->f_code->co_argcount > 0) {
      |                ^~~~~~
include/pybind11/pybind11.h:2026:20: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_locals'
 2026 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                    ^~~~~~~~
In file included from /usr/include/python3.11/Python.h:35,
                 from include/pybind11/detail/common.h:112,
                 from include/pybind11/pytypes.h:12,
                 from include/pybind11/cast.h:13:
include/pybind11/pybind11.h:2026:54: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2026 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                                                      ^~~~~~
/usr/include/python3.11/tupleobject.h:27:18: note: in expansion of macro 'PyType_FastSubclass'
   27 |                  PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
      |                  ^~~~~~~~~~~~~~~~~~~
/usr/include/python3.11/object.h:140:30: note: in expansion of macro '_PyObject_CAST_CONST'
  140 | #define Py_TYPE(ob) _Py_TYPE(_PyObject_CAST_CONST(ob))
      |                              ^~~~~~~~~~~~~~~~~~~~
/usr/include/python3.11/tupleobject.h:27:38: note: in expansion of macro 'Py_TYPE'
   27 |                  PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
      |                                      ^~~~~~~
/usr/include/python3.11/cpython/tupleobject.h:19:35: note: in expansion of macro 'PyTuple_Check'
   19 | #define _PyTuple_CAST(op) (assert(PyTuple_Check(op)), (PyTupleObject *)(op))
      |                                   ^~~~~~~~~~~~~
/usr/include/python3.11/cpython/tupleobject.h:23:34: note: in expansion of macro '_PyTuple_CAST'
   23 | #define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i])
      |                                  ^~~~~~~~~~~~~
include/pybind11/pybind11.h:2026:30: note: in expansion of macro 'PyTuple_GET_ITEM'
 2026 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                              ^~~~~~~~~~~~~~~~
In file included from /usr/include/python3.11/tupleobject.h:39,
                 from /usr/include/python3.11/Python.h:57:
include/pybind11/pybind11.h:2026:54: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2026 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                                                      ^~~~~~
/usr/include/python3.11/cpython/tupleobject.h:19:73: note: in definition of macro '_PyTuple_CAST'
   19 | #define _PyTuple_CAST(op) (assert(PyTuple_Check(op)), (PyTupleObject *)(op))
      |                                                                         ^~
include/pybind11/pybind11.h:2026:30: note: in expansion of macro 'PyTuple_GET_ITEM'
 2026 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                              ^~~~~~~~~~~~~~~~
make[1]: *** [Makefile:69: tmp-python-3/Analysis.o] Error 1

Changes of the PyFrameObject structure members:
    f_code: removed, use PyFrame_GetCode() instead. Warning: the function returns a strong reference, need to call Py_DECREF().
    f_back: changed, use PyFrame_GetBack().
    f_builtins: removed, use PyObject_GetAttrString(frame, "f_builtins").
    f_globals: removed, use PyObject_GetAttrString(frame, "f_globals").
    f_locals: removed, use PyObject_GetAttrString(frame, "f_locals").
    f_lasti: removed, use PyObject_GetAttrString(frame, "f_lasti").
    f_valuesstack: removed.
    f_stackdepth: removed.
    f_gen: removed.
    f_iblock: removed.
    f_state: removed.
    f_blockstack: removed.
    f_localsplus: removed.
The Python frame object is now created lazily. A side effect is that the f_back member must not be accessed directly, since its value is now also computed lazily. The PyFrame_GetBack() function must be called instead.

https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03250083-pythia8/

For all our attempts to build pythia8 with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/pythia8/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Ben Cotton 2022-02-08 20:41:55 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 2 Miro Hrončok 2022-06-20 10:16:25 UTC
*** Bug 2098795 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.