You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm not 100% sure if this is an error in the signature for the backport, or in pyright. But strict mypy handles it without problem both on <3.11 and >=3.11. The code works without problem if pyright is targeting version==3.11.
$ pyright foo.py
/tmp/pyright_exceptiongroup/foo.py
/tmp/pyright_exceptiongroup/foo.py:6:9 - error: Argument type is partially unknown
Argument corresponds to parameter "args" in function "__init__"
Argument type is "tuple[ExceptionGroup[Unknown]]" (reportUnknownArgumentType)
1 error, 0 warnings, 0 informations
$ pip list
Package Version
----------------- -------
exceptiongroup 1.2.0
pyright 1.1.342
[...]
This is a due to a bug in the exceptiongroups library. The exceptiongroup/_exceptions.py module contains the following import statement:
ifTYPE_CHECKING:
fromtypingimportSelf
But the Self symbol isn't exported from the typing module for Python versions older than 3.11. The symbol should be imported from typing_extensions instead.
This doesn't affect mypy because mypy does not honor the return type of __new__. If and when mypy maintainers implement support for __new__ return type annotations, this same bug will affect mypy.
Describe the bug
I'm not 100% sure if this is an error in the signature for the backport, or in pyright. But strict mypy handles it without problem both on <3.11 and >=3.11. The code works without problem if pyright is targeting version==3.11.
I encountered the error in the following PR: python-trio/trio#2898
https://github.com/python-trio/trio/actions/runs/7300704573/job/19895902558?pr=2898#step:5:1647
Code or Screenshots
foo.py
pyproject.toml
The signature in the backport can be seen at https://github.com/agronholm/exceptiongroup/blob/main/src/exceptiongroup/_exceptions.py and as far as I can tell it doesn't differ from the one in typeshed https://github.com/python/typeshed/blob/main/stdlib/builtins.pyi#L2130
The text was updated successfully, but these errors were encountered: