- 
    Bug 
- 
    Resolution: Fixed
- 
    P3: Somewhat important 
- 
    6.10.0
- 
    None
- 
        
- 
        a33f25772 (dev), 1dc631efe (6.9)
When adding a function with a PySequence and a numpy overload (specified by PyArrayObject, see https://codereview.qt-project.org/c/pyside/pyside-setup/+/642868 ), the PyArrayObject is mapped to
"PyArrayObject": ArrayLikeVariable(typing.Any), # numpy
by sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py:234, leading to
   @typing.overload
    def __init__(self, list: collections.abc.Iterable, /, parent: PySide6.QtCore.QObject | None = ...) -> None: ...
    @typing.overload
    def __init__(self, data: collections.abc.Sequence[typing.Any], /, parent: PySide6.QtCore.QObject | None = ...) -> None: ...
This causes an error in sources/pyside6/tests/pysidetest/mypy_correctness_test.py :
/QtCore.pyi:3457: error: Overloaded function signature 2 will
never be matched: signature 1's parameter type(s) are the same or broader
[overload-cannot-match]
        def __init__(self, data: collections.abc.Sequence[typing.Any], /, ...
Found 1 error in 1 file (checked 10 source files)
For this, the type hint for numpy needs to be more specific (see also https://numpy.org/devdocs/reference/typing.html ).
Note though it is possible to build PySide without numpy (--disable-numpy-support), and importing numpy directly can be costly.
- relates to
- 
                    PYSIDE-3011 Adapt to 6.10 -         
- In Review
 
-         
| For Gerrit Dashboard: PYSIDE-3098 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V | 
| 644824,3 | WIP: Type hints: Use numpy correctly/brute force | dev | pyside/pyside-setup | Status: ABANDONED | -2 | 0 | 
| 645399,2 | WIP: Reproduce PYSIDE-3098 | dev | pyside/pyside-setup | Status: ABANDONED | -2 | 0 | 
| 645469,5 | type hints: Improve topological sorting between Sequence and Iterable | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 | 
| 645538,2 | type hints: Improve topological sorting between Sequence and Iterable | 6.9 | pyside/pyside-setup | Status: MERGED | +2 | 0 |