Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
6.6.0, 6.5.3
-
None
-
eeda9bf85 (dev), 238a979f9 (6.6), 7390c652a (tqtc/lts-6.5)
Description
The current type stubs seem to rely on an old poorly documented (and now deprecated) behaviour where type checkers would treat `bytes` as the union `bytes | bytearray | memoryview` in annotations.
The union should now be explicit, or even better (especially for c-bindings, like PySide) use the new Buffer Protocol. See https://peps.python.org/pep-0688/
pyright 1.1.329 now stops implying `bytes` as `bytes | bytearray | memoryview` union by default in strict mode ( https://github.com/microsoft/pyright/releases/tag/1.1.329 )
mypy has two hidden flags (--disable-bytearray-promotionĀ andĀ --disable-memoryview-promotion) which will be default in the next major version (see https://github.com/python/mypy/issues/15313 )
For instance, passing a `memoryview` to `QImage` will now result in an error in strict mode