Bug 2049675

Summary: opae fails to build with Python 3.11: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: opaeAssignee: Gwendolyn Casey <gcasey>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 37CC: ananda.ravuri, gcasey, mhroncok, nakul.korde, thrnciar, trix
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-19 12:49:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2117176, 2016048, 2045102, 2045109, 2052217    

Description Tomáš Hrnčiar 2022-02-02 14:28:40 UTC
opae fails to build with Python 3.11.0a4.

In file included from /builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/attr.h:13,
                 from /builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/pybind11.h:45,
                 from /builddir/build/BUILD/opae-2.0.0-2/tools/extra/fpgadiag/eth_group.cpp:29:
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/cast.h: In function 'std::string pybind11::detail::error_string()':
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/cast.h:446:38: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
  446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                      ^~~~~~
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/cast.h:446:75: error: expected primary-expression before '>' token
  446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                                                           ^
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/cast.h:446:77: error: expected primary-expression before ')' token
  446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                                                             ^
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/cast.h:448:31: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
  448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                               ^~~~~~
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/cast.h:448:64: error: expected primary-expression before '>' token
  448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                                                                ^
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/cast.h:448:66: error: expected primary-expression before ')' token
  448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                                                                  ^
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/pybind11.h: In function 'pybind11::function pybind11::detail::get_type_override(const void*, const type_info*, const char*)':
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/pybind11.h:2218:49: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'frame'; did you mean 'cframe'?
 2218 |     PyFrameObject *frame = PyThreadState_Get()->frame;
      |                                                 ^~~~~
      |                                                 cframe
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/pybind11.h:2219:43: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2219 |     if (frame && (std::string) str(frame->f_code->co_name) == name &&
      |                                           ^~~~~~
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/pybind11.h:2220:16: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2220 |         frame->f_code->co_argcount > 0) {
      |                ^~~~~~
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/pybind11.h:2223:20: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_locals'
 2223 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                    ^~~~~~~~
In file included from /usr/include/python3.11/Python.h:35,
                 from /builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/detail/common.h:122,
                 from /builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/pytypes.h:12,
                 from /builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/cast.h:13:
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/pybind11.h:2223:30: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2223 |             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:
/builddir/build/BUILD/opae-2.0.0-2/external/pybind11/include/pybind11/pybind11.h:2223:30: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 2223 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                              ^~~~~~~~~~~~~~~~
gmake[2]: *** [tools/extra/fpgadiag/CMakeFiles/eth_group.dir/build.make:79: tools/extra/fpgadiag/CMakeFiles/eth_group.dir/eth_group.cpp.o] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/opae-2.0.0-2/redhat-linux-build'
gmake[1]: *** [CMakeFiles/Makefile2:1747: tools/extra/fpgadiag/CMakeFiles/eth_group.dir/all] Error 2

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/03269688-opae/

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

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:20:02 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:15:34 UTC
*** Bug 2098762 has been marked as a duplicate of this bug. ***

Comment 3 Miro Hrončok 2022-06-27 14:53:18 UTC
Hello,

This is the first reminder (step 3 from https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/#_package_removal_for_long_standing_ftbfs_and_fti_bugs).

If you know about this problem and are planning on fixing it, please acknowledge so by setting the bug status to ASSIGNED. If you don't have time to maintain this package, consider orphaning it, so maintainers of dependent packages realize the problem.

Comment 4 Tom Rix 2022-06-27 14:59:00 UTC
Gwen can you pick this up ?

Comment 5 Gwendolyn Casey 2022-07-06 04:07:52 UTC
waiting for PR to be merged to fix this

Comment 6 Ben Cotton 2022-08-09 13:37:59 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.

Comment 7 Miro Hrončok 2022-08-19 12:47:21 UTC
Hello,

Please note that this comment was generated automatically. If you feel that this output has mistakes, please contact me via email (mhroncok).

All subpackages of a package against which this bug was filled are now installable or removed from Fedora 38.

Thanks for taking care of it!

Comment 8 Miro Hrončok 2022-08-19 12:49:03 UTC
Hello,

Please note that this comment was generated automatically. If you feel that this output has mistakes, please contact me via email (mhroncok).

All subpackages of a package against which this bug was filled are now installable or removed from Fedora 37.

Thanks for taking care of it!