Bug 2049695 - mod_wsgi fails to build with Python 3.11: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
Summary: mod_wsgi fails to build with Python 3.11: error: 'PyFrameObject' {aka 'struct...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mod_wsgi
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Matthias Runge
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-02-02 14:53 UTC by Tomáš Hrnčiar
Modified: 2022-05-02 06:00 UTC (History)
8 users (show)

Fixed In Version: mod_wsgi-4.9.1-1.fc37
Clone Of:
Environment:
Last Closed: 2022-05-02 05:35:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github GrahamDumpleton mod_wsgi issues 760 0 None closed mod_wsgi fails to build with Python 3.11.0a4 2022-05-02 04:42:32 UTC

Description Tomáš Hrnčiar 2022-02-02 14:53:06 UTC
mod_wsgi fails to build with Python 3.11.0a4.

src/server/mod_wsgi.c: In function 'wsgi_log_stack_traces':
src/server/mod_wsgi.c:9528:58: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 9528 |                         lineno = PyCode_Addr2Line(current->f_code,
      |                                                          ^~
src/server/mod_wsgi.c:9529:58: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_lasti'
 9529 |                                                   current->f_lasti);
      |                                                          ^~
src/server/mod_wsgi.c:9533:56: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 9533 |                     filename = PyUnicode_AsUTF8(current->f_code->co_filename);
      |                                                        ^~
src/server/mod_wsgi.c:9534:52: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 9534 |                     name = PyUnicode_AsUTF8(current->f_code->co_name);
      |                                                    ^~
apxs:Error: Command failed with rc=65536

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.

Code defining PyFrame_GetCode() on Python 3.8 and older:

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/03271443-mod_wsgi/

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

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:19:52 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-02-12 15:11:41 UTC
Changing severity here as this will prevent FreeIPA server from being installed, thus violating Fedora Server criteria:

https://fedoraproject.org/wiki/Basic_Release_Criteria#FreeIPA_server_requirements

Comment 3 Alexander Bokovoy 2022-02-14 09:07:56 UTC
Opened upstream issue https://github.com/GrahamDumpleton/mod_wsgi/issues/760

Comment 4 Alexander Bokovoy 2022-05-02 04:43:40 UTC
Upstream bug was closed today with the comment: "... latest release (4.9.1) should at least compile. Whether it falls over and bursts into flames at runtime because of other Python 3.11 changes will be a different matter. :-)"

Comment 5 Alexander Bokovoy 2022-05-02 05:00:45 UTC
I submitted PR to update Fedora build to 4.9.1: https://src.fedoraproject.org/rpms/mod_wsgi/pull-request/14

Comment 6 Fedora Update System 2022-05-02 05:34:27 UTC
FEDORA-2022-214c09095d has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-214c09095d

Comment 7 Fedora Update System 2022-05-02 05:35:49 UTC
FEDORA-2022-214c09095d has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Matthias Runge 2022-05-02 06:00:11 UTC
Thank you, I merged the PR and built the package.


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