Bug 2093917 - domoticz fails to build with Python 3.11: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
Summary: domoticz fails to build with Python 3.11: error: invalid use of incomplete ty...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: domoticz
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michael Cronenworth
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-06-06 11:33 UTC by Tomáš Hrnčiar
Modified: 2022-08-26 03:55 UTC (History)
3 users (show)

Fixed In Version: domoticz-2022.1-5.fc38
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-08-26 03:55:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-06-06 11:33:28 UTC
domoticz fails to build with Python 3.11.0b3.

/builddir/build/BUILD/domoticz-2022.1/hardware/plugins/Plugins.cpp: In function 'int Plugins::PyDomoticz_ProfileFunc(PyObject*, PyFrameObject*, int, PyObject*)':
/builddir/build/BUILD/domoticz-2022.1/hardware/plugins/Plugins.cpp:203:52: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
  203 |                         PyCodeObject *pCode = frame->f_code;
      |                                                    ^~
In file included from /usr/include/python3.11/Python.h:42:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~
/builddir/build/BUILD/domoticz-2022.1/hardware/plugins/Plugins.cpp: In function 'int Plugins::PyDomoticz_TraceFunc(PyObject*, PyFrameObject*, int, PyObject*)':
/builddir/build/BUILD/domoticz-2022.1/hardware/plugins/Plugins.cpp:247:52: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
  247 |                         PyCodeObject *pCode = frame->f_code;
      |                                                    ^~
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~
/builddir/build/BUILD/domoticz-2022.1/hardware/plugins/Plugins.cpp: In member function 'void Plugins::CPlugin::LogTraceback(PyTracebackObject*)':
/builddir/build/BUILD/domoticz-2022.1/hardware/plugins/Plugins.cpp:938:60: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
  938 |                                 PyCodeObject *pCode = frame->f_code;
      |                                                            ^~
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~

The PyFrameObject structure members have been removed from the public C API.

While the documentation notes that the PyFrameObject fields are subject to change at any time, they have been stable for a long time and were used in several popular extensions.

In Python 3.11, the frame struct was reorganized to allow performance optimizations. Some fields were removed entirely, as they were details of the old implementation.

PyFrameObject fields:
    f_back: use PyFrame_GetBack().
    f_blockstack: removed.
    f_builtins: use PyFrame_GetBuiltins().
    f_code: use PyFrame_GetCode().
    f_gen: use PyFrame_GetGenerator().
    f_globals: use PyFrame_GetGlobals().
    f_iblock: removed.
    f_lasti: use PyFrame_GetLasti(). Code using f_lasti with PyCode_Addr2Line() should use PyFrame_GetLineNumber() instead; it may be faster.
    f_lineno: use PyFrame_GetLineNumber()
    f_locals: use PyFrame_GetLocals().
    f_stackdepth: removed.
    f_state: no public API (renamed to f_frame.f_state).
    f_trace: no public API.
    f_trace_lines: use PyObject_GetAttrString((PyObject*)frame, "f_trace_lines").
    f_trace_opcodes: use PyObject_GetAttrString((PyObject*)frame, "f_trace_opcodes").
    f_localsplus: no public API (renamed to f_frame.localsplus).
    f_valuestack: 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/04493594-domoticz/

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

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 Stefan van der Eijk 2022-06-06 13:17:02 UTC
I don't think many people use the domoticz package in Fedora. There are also alternatives that work --> running domoticz in docker.

Comment 2 Michael Cronenworth 2022-06-06 13:24:19 UTC
Thanks, but your comment does not contribute to resolving this bug report. Docker is not an alternative.

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

Comment 4 Miro Hrončok 2022-08-25 09:44:52 UTC
This Bugzilla was ASSIGNED on 2022-06-06 but nothing happened. We are past Fedora 37 Beta Freeze and this package does not even install. What is the plan wrt this package? Can it please be removed from the distribution until this is solved?

Comment 5 Fedora Update System 2022-08-26 03:53:44 UTC
FEDORA-2022-3662c583c3 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2022-3662c583c3

Comment 6 Fedora Update System 2022-08-26 03:55:08 UTC
FEDORA-2022-3662c583c3 has been pushed to the Fedora 38 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.