Bug 2025599
Summary: | python-pyside2 fails to build with Python 3.11: error: expression is not assignable | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Tomáš Hrnčiar <thrnciar> |
Component: | python-pyside2 | Assignee: | Richard Shaw <hobbes1069> |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | rawhide | CC: | code, henrik, hobbes1069, laurent.rineau__fedora, mhroncok, pviktori, sam, sergio, thrnciar, trpost, tuju |
Target Milestone: | --- | Keywords: | Reopened |
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-07-01 10:42:13 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: | 2016048, 2045102, 2045109, 2098704, 2098744, 2099067, 2099088, 2099131, 2099184 |
Description
Tomáš Hrnčiar
2021-11-22 14:55:01 UTC
This is a first for me... I setup the mock config but when I try to run it I get this: Start: dnf install Traceback (most recent call last): File "/usr/bin/dnf", line 57, in <module> from dnf.cli import main File "/usr/lib/python3.10/site-packages/dnf/__init__.py", line 30, in <module> import dnf.base File "/usr/lib/python3.10/site-packages/dnf/base.py", line 32, in <module> from dnf.comps import CompsQuery File "/usr/lib/python3.10/site-packages/dnf/comps.py", line 27, in <module> from dnf.exceptions import CompsError File "/usr/lib/python3.10/site-packages/dnf/exceptions.py", line 22, in <module> import dnf.util File "/usr/lib/python3.10/site-packages/dnf/util.py", line 29, in <module> import dnf.callback File "/usr/lib/python3.10/site-packages/dnf/callback.py", line 22, in <module> import dnf.yum.rpmtrans File "/usr/lib/python3.10/site-packages/dnf/yum/rpmtrans.py", line 26, in <module> import rpm ModuleNotFoundError: No module named 'rpm' Pass --no-bootstrap-chroot to mock please. Not sure why that's needed but updating to the latest version worked. Mock by default uses a bootstrap chroot which uses dnf from our Copr repo and dnf is not yet available/working there. As a result of a previous incident, some of the packages in copr have insufficient Requires, so python3-rpm from Python 3.11 was happily installed with dnf from Rawhide into the bootstrap chroot. We are in the process of fixing this. Whoops, closed the wrong bug. python-collada is fixed, not this package. I've fixed the above error but now I'm getting something that's completely confusing me: /builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/redhat-linux-build/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py:199: RuntimeWarning: pyside_type_init: UNRECOGNIZED: 'zero(Any)' OFFENDING LINE: 'PySide2.QtCore.QSettings.value(self,arg__1:QString,defaultValue:QVariant=0,type:PyObject=0)->PyObject' warnings.warn("""pyside_type_init: Traceback (most recent call last): File "/builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 326, in <module> generate_all_pyi(outpath, options=options) File "/builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 305, in generate_all_pyi generate_pyi(import_name, outpath, options) File "/builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 241, in generate_pyi HintingEnumerator(fmt).module(import_name) File "/builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/redhat-linux-build/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py", line 95, in module ret.update(self.klass(class_name, klass)) File "/builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/redhat-linux-build/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py", line 129, in klass signature = getattr(thing, "__signature__", None) File "/builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/redhat-linux-build/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/loader.py", line 97, in pyside_type_init return parser.pyside_type_init(type_key, sig_strings) File "/builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/redhat-linux-build/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py", line 447, in pyside_type_init props = calculate_props(line) File "/builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/redhat-linux-build/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py", line 344, in calculate_props annotations["return"] = (_resolve_type(returntype, line, 0, handle_retvar) File "/builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/redhat-linux-build/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py", line 280, in _resolve_type return eval(result, namespace) File "<string>", line 1, in <module> File "/usr/lib64/python3.10/typing.py", line 1182, in __getitem__ return self.__getitem_inner__(params) File "/usr/lib64/python3.10/typing.py", line 309, in inner return func(*args, **kwds) File "/usr/lib64/python3.10/typing.py", line 1188, in __getitem_inner__ result = _type_check(result, msg) File "/usr/lib64/python3.10/typing.py", line 169, in _type_check raise TypeError(f"Plain {arg} is not valid as type argument") TypeError: Plain typing.Optional is not valid as type argument And this is with f35... I tried starting with f34 to ensure building completes, and it does, and am now working my way up to rawhide. Can you share your changes so far so I can poke around?
Do you know what is being eval'd in parser.py:280?
Or which file is being parsed here?
I can get this error by parametrizing types using typing.Optional, e.g.
>>> import typing
>>> typing.List[typing.Optional]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.10/typing.py", line 311, in inner
return func(*args, **kwds)
File "/usr/lib64/python3.10/typing.py", line 1123, in __getitem__
params = tuple(_type_check(p, msg) for p in params)
File "/usr/lib64/python3.10/typing.py", line 1123, in <genexpr>
params = tuple(_type_check(p, msg) for p in params)
File "/usr/lib64/python3.10/typing.py", line 171, in _type_check
raise TypeError(f"Plain {arg} is not valid as type argument")
TypeError: Plain typing.Optional is not valid as type argument
To be usable, Optional itself needs to be parametrized, e.g. typing.List[typing.Optional[int]]
But I don't know how the PySide build got here.
Ah, maybe I found it! It seems shiboken relies on "special forms" like Optional not having __name__, which they got in Python 3.10. In `to_string` in shibokensupport/signature/parser.py, try replacing: if hasattr(thing, "__name__"): with: if hasattr(thing, "__name__") and not hasattr(thing, "__args__"): This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle. Changing version to 36. *** Bug 2099081 has been marked as a duplicate of this bug. *** (In reply to Tomáš Hrnčiar from comment #0) > python-pyside2 fails to build with Python 3.11.0a2. > > /builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/sources/shiboken2/ > libshiboken/basewrapper.cpp:369:23: error: expression is not assignable > Py_TYPE(type) = SbkObjectType_TypeF(); > ~~~~~~~~~~~~~ ^ > /builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/sources/shiboken2/ > libshiboken/basewrapper.cpp:515:5: warning: 'UsingDeprecatedTrashcanMacro' > is deprecated [-Wdeprecated-declarations] > Py_TRASHCAN_SAFE_BEGIN(pyObj); > ^ > /usr/include/python3.11/cpython/object.h:547:9: note: expanded from macro > 'Py_TRASHCAN_SAFE_BEGIN' > UsingDeprecatedTrashcanMacro cond=1; \ > ^ > /usr/include/python3.11/cpython/object.h:544:1: note: > 'UsingDeprecatedTrashcanMacro' has been explicitly marked deprecated here > Py_DEPRECATED(3.11) typedef int UsingDeprecatedTrashcanMacro; > ^ > /usr/include/python3.11/pyport.h:392:54: note: expanded from macro > 'Py_DEPRECATED' > #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) > ^ > /builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/sources/shiboken2/ > libshiboken/basewrapper.cpp:1113:23: error: expression is not assignable > Py_TYPE(heaptype) = SbkObjectType_TypeF(); > ~~~~~~~~~~~~~~~~~ ^ > 1 warning and 2 errors generated. > > Since Py_TYPE() is changed to a inline static function, Py_TYPE(obj) = > new_type must be replaced with Py_SET_TYPE(obj, new_type): see the > Py_SET_TYPE() function (available since Python 3.9). For backward > compatibility, this macro can be used: > > #if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE) > static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type) > { ob->ob_type = type; } > #define Py_SET_TYPE(ob, type) _Py_SET_TYPE((PyObject*)(ob), type) > #endif > > (Contributed by Victor Stinner in bpo-39573.) > > https://bugs.python.org/issue39573 > https://docs.python.org/3.11/whatsnew/3.11.html we have about 170 Py_TYPE in code [1] here [2] is suggest that `Py_TYPE(ob)` can be replaced with `ob->ob_type` , am I right ? [1] ack Py_TYPE | wc -l 181 [2] https://github.com/python/cpython/issues/91768#issue-1210326060 There is ongoing release with initial python-3.11 support. https://wiki.qt.io/Qt_for_Python_Development_Notes (In reply to Henrik Nordström from comment #12) > There is ongoing release with initial python-3.11 support. > > https://wiki.qt.io/Qt_for_Python_Development_Notes and where is the source code of Qt_for_Python or patches available ? I've opened https://src.fedoraproject.org/rpms/python-pyside2/pull-request/9 But it fails on me with: [ 50%] Built target QtGui gmake[1]: Leaving directory '/builddir/build/BUILD/pyside-setup-opensource-src-5.15.2/redhat-linux-build' gmake: *** [Makefile:139: all] Error 2 There is no compiler error above that :/ This cannot build on power due to bz2100546. This is not the only problem, but if we fix everything else, that will block. (In reply to Sergio Basto from comment #13) > and where is the source code of Qt_for_Python or patches available ? Don't think there is any patches available, or a ready release for Python 3.11 yet. Was just to notify that upstream is actively working on it. And is very possible that work is only done on PySide6. https://download.qt.io/official_releases/QtForPython/pyside2/ has several releases after the latest release. Don't know their status. GIT repo is at https://code.qt.io/cgit/pyside/pyside-setup.git/ Project home page at https://wiki.qt.io/Qt_for_Python FEDORA-2022-3ab3f9bdbc has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-3ab3f9bdbc FEDORA-2022-3ab3f9bdbc has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report. Sorry, it looks like I tagged the wrong bug in a usd update. Reopening. The fix is ready in https://src.fedoraproject.org/rpms/python-pyside2/pull-request/10 but this package cannot build due to bz2100546. 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! FEDORA-2022-e4f83ff98e has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-e4f83ff98e FEDORA-2022-e4f83ff98e has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report. |