Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.11 ExceptionGroup is incorrectly flagged as type value not ExceptionGroup #2762

Closed
tonybaloney opened this issue May 3, 2022 · 4 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@tonybaloney
Copy link

Environment data

  • Language Server version: v2022.3.4
  • OS and version: Windows 11
  • Python version: 3.11a7

Expected behavior

PyLance infers except* statements to be of type ExceptionGroup

Actual behavior

PyLance infers exception types as the filter type

Code Snippet / Additional information

try:
    raise ExceptionGroup("Demo", [ValueError("ooops"), ValueError("Whoopsie")])
except* ValueError as e:
    print(e)

image

See https://peps.python.org/pep-0654/ for the reference on the syntax

@github-actions github-actions bot added the triage label May 3, 2022
@tonybaloney
Copy link
Author

CC @iritkatriel

@erictraut
Copy link
Contributor

Thanks for clarifying. When I initially added support for except* in pyright, I didn't have access to a runtime that supported it, so I couldn't validate my assumptions.

This will be fixed in the next release of pyright & pylance.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels May 3, 2022
@debonte
Copy link
Contributor

debonte commented May 5, 2022

@tonybaloney, the fix is available in the latest Pylance insiders build (2022.5.0-pre.1). We're not shipping a stable build this week. If you're not using Pylance insiders, you'll see the fix in next week's stable build.

@tonybaloney
Copy link
Author

Works a charm. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants