Bug 2049682 - profanity fails to build with Python 3.11: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
Summary: profanity fails to build with Python 3.11: error: 'PyFrameObject' {aka 'struc...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: profanity
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Matthieu Saulnier
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: F38FTBFS PYTHON3.11 F37FTBFS
TreeView+ depends on / blocked
 
Reported: 2022-02-02 14:39 UTC by Tomáš Hrnčiar
Modified: 2022-09-19 00:18 UTC (History)
3 users (show)

Fixed In Version: profanity-0.13.0-1.fc37
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-09-19 00:18:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-02-02 14:39:01 UTC
profanity fails to build with Python 3.11.0a4.

src/plugins/python_api.c: In function 'python_api_register_command':
src/plugins/python_api.c:199:31: warning: the comparison will always evaluate as 'true' for the address of 'c_arguments' will never be NULL [-Waddress]
  199 |         while (c_arguments[i] != NULL && c_arguments[i][0] != NULL) {
      |                               ^~
src/plugins/python_api.c:161:15: note: 'c_arguments' declared here
  161 |         char* c_arguments[args_len == 0 ? 0 : args_len + 1][2];
      |               ^~~~~~~~~~~
src/plugins/python_api.c: In function '_python_plugin_name':
src/plugins/python_api.c:1622:32: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'frame'; did you mean 'cframe'?
 1622 |     PyFrameObject* frame = ts->frame;
      |                                ^~~~~
      |                                cframe
src/plugins/python_api.c:1623:59: error: 'PyFrameObject' {aka 'struct _frame'} has no member named 'f_code'
 1623 |     char* filename = python_str_or_unicode_to_string(frame->f_code->co_filename);
      |                        

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/03269748-profanity/

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

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 Matthieu Saulnier 2022-02-02 17:20:04 UTC
I opened ticket for upstream:

https://github.com/profanity-im/profanity/issues/1634

Actually, no package is depending of profanity or libprofanity (library is used by plugins of profanity).

Python is not a strong (build) dependancy, since it is used only for python plugins, of profanity.

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

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

Comment 4 Matthieu Saulnier 2022-09-14 14:32:10 UTC
(In reply to Matthieu Saulnier from comment #1)
> Actually, no package is depending of profanity or libprofanity (library is
> used by plugins of profanity).
> 
> Python is not a strong (build) dependancy, since it is used only for python
> plugins, of profanity.

By the way, I removed the python plugin support in rawhide+f37:

https://bodhi.fedoraproject.org/updates/FEDORA-2022-245be5acd2

Comment 5 Fedora Update System 2022-09-14 14:55:48 UTC
FEDORA-2022-245be5acd2 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-245be5acd2

Comment 6 Fedora Update System 2022-09-15 01:48:44 UTC
FEDORA-2022-245be5acd2 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-245be5acd2`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-245be5acd2

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2022-09-19 00:18:57 UTC
FEDORA-2022-245be5acd2 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


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