A few issue with 6.2.0

Damien Elmes pyqt at ankiweb.net
Sun Oct 24 05:03:53 BST 2021


One other issue I forgot to mention - QByteArray can't be pickled on Python
10:

>>> from PyQt6.QtCore import QByteArray
>>> import pickle
>>> pickle.dumps(QByteArray(b"test"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

>
> > - the macos_amd64 wheels should probably use 11_0 - they are currently
> > 10_14, and pip refuses to install them with 'no matching distributions'
> > on
> > an Apple M1 machine.
>
> That sounds like a pip bug as 10.4 is the minimum required version. What
> is the output of 'pip --verbose debug'?
>

Sorry, that should have read _arm64 above.

dae at armmini ~ % ./venv2/bin/pip install pyqt6-webengine
Collecting pyqt6-webengine
  Using cached PyQt6_WebEngine-6.2.0-cp36-abi3-macosx_10_14_universal2.whl
(357 kB)
Collecting PyQt6-sip<14,>=13.1
  Using cached PyQt6_sip-13.1.0-cp39-cp39-macosx_11_0_arm64.whl
ERROR: Could not find a version that satisfies the requirement
PyQt6-WebEngine-Qt6>=6.2.0 (from pyqt6-webengine) (from versions: none)
ERROR: No matching distribution found for PyQt6-WebEngine-Qt6>=6.2.0

dae at armmini ~ % ./venv2/bin/pip --verbose debug | grep cp39 | grep arm
WARNING: This command is only meant for debugging. Do not use this with
automation for parsing and getting these details, since the output and
options of this command may change without notice.
  cp39-cp39-macosx_11_0_arm64
  cp39-abi3-macosx_11_0_arm64
  cp39-none-macosx_11_0_arm64

dae at armmini ~ % ./venv2/bin/pip --verbose debug | grep cp39 | grep universal
WARNING: This command is only meant for debugging. Do not use this with
automation for parsing and getting these details, since the output and
options of this command may change without notice.
  cp39-cp39-macosx_11_0_universal2
  cp39-cp39-macosx_10_16_universal2
  cp39-cp39-macosx_10_15_universal2
  cp39-cp39-macosx_10_14_universal2
  cp39-cp39-macosx_10_13_universal2
  cp39-cp39-macosx_10_12_universal2
  cp39-cp39-macosx_10_11_universal2
  cp39-cp39-macosx_10_10_universal2
  cp39-cp39-macosx_10_9_universal2
[...]

Workaround for now is to specify the older arch:

./venv2/bin/pip install pyqt6-qt6 pyqt6-webengine-qt6
--platform=macosx_10_14_arm64 --only-binary=:all: --no-deps --target
venv2/ext


> > codesign -s  - \
> >
> PyQt6/Qt6/lib/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess
>
> I can't reproduce this (on an Intel Mac). The original file is not
> signed.
>

I misspoke - the issue is arm64-specific - on arm64, unsigned code won't
run at all, so XCode will automatically
give outputs an 'ad-hoc' signature when they are created:

dae at armmini ~ % codesign -dvv
venv2/ext/PyQt6/Qt6/lib/QtWebEngineCore.framework/Versions/A/QtWebEngineCore
Executable=/Users/dae/venv2/ext/PyQt6/Qt6/lib/QtWebEngineCore.framework/Versions/A/QtWebEngineCore
Identifier=QtWebEngineCore
Format=Mach-O thin (arm64)
CodeDirectory v=20400 size=1122728 flags=0x20002(adhoc,linker-signed)
hashes=35082+0 location=embedded
Signature=adhoc
[...]
dae at armmini ~ % codesign -vv
venv2/ext/PyQt6/Qt6/lib/QtWebEngineCore.framework/Versions/A/QtWebEngineCore
venv2/ext/PyQt6/Qt6/lib/QtWebEngineCore.framework/Versions/A/QtWebEngineCore:
valid on disk
venv2/ext/PyQt6/Qt6/lib/QtWebEngineCore.framework/Versions/A/QtWebEngineCore:
satisfies its Designated Requirement

The helper has an ad-hoc signature too, but it's malformed:

dae at armmini ~ % codesign -vv
venv2/ext/PyQt6/Qt6/lib/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess
venv2/ext/PyQt6/Qt6/lib/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess:
invalid signature (code or signature have been modified)
In architecture: arm64

>
> > 60-      <widget class="QComboBox" name="field">
> > 61-       <property name="sizeAdjustPolicy">
> > 62:
> > <enum>QComboBox::AdjustToMinimumContentsLengthWithIcon</enum>
> > 63-       </property>
> > 64-      </widget>
>
> Fixed for QAction.MenuRole but QComboBox.SizeAdjustPolicy should be
> fine. Do you have a .ui file that demonstrates the problem?
>

Sorry, I mistakenly lumped this one in with the other one, but it was a
different
issue that was not PyQt's fault (QComboBox::AdjustToMinimumContentsLength
needed to be changed to QComboBox::AdjustToMinimumContentsLengthWithIcon
in the UI file)

>
> > # inheriting from the missing sip.sipwrapper definition
> > # causes missing attributes not to be detected, as it's treating
> > # the class as inheriting from Any
> > line = line.replace("PyQt6.sip.wrapper", "object")
>
> sip.wrapper is not missing, it is defined in sip.pyi.
>

I thought I checked this after updating to PyQt6, but I can't reproduce the
issue now.


> > We also automatically add '# type: ignore' comments to any '.connect('
> > line
> > in generated uic files, as the types don't currently cover the signals.
> > Apart from that, the typing is working great.
>
> Can you give me an example of a modified file - just so that I get it
> right first time.
>

Here's a few:

        self.buttonBox.accepted.connect(ChangeMap.accept)  # type: ignore
        self.fields.doubleClicked['QModelIndex'].connect(ChangeMap.accept)
 # type: ignore

self.activeCheck.toggled['bool'].connect(self.activeList.setEnabled)  #
type: ignore

Without them, we get errors like:

aqt/forms/taglimit_qt6.py:54: error: "Callable[[], None]" has no attribute
"connect"  [attr-defined]
aqt/forms/taglimit_qt6.py:55: error: Value of type "Callable[[bool], None]"
is not indexable  [index]

Cheers,
Damien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20211024/98453ece/attachment.htm>


More information about the PyQt mailing list