Skip to content

Fixed "raise" with string literals instead of an exception#736

Merged
swernli merged 2 commits intomicrosoft:mainfrom
filipw:ValueError
Mar 24, 2026
Merged

Fixed "raise" with string literals instead of an exception#736
swernli merged 2 commits intomicrosoft:mainfrom
filipw:ValueError

Conversation

@filipw
Copy link
Contributor

@filipw filipw commented Mar 23, 2026

Hi, I cloned the repo and immediately run into these pylance errors:

Screenshot 2026-03-23 at 16 43 58

Raise with a string literal does not raise an exception in Python 3 - instead it leads to TypeError: exceptions must derive from BaseException. This means any time this code path would be hit, it will error with a confusing TypeError instead of the intended error message.

@filipw filipw requested a review from a team as a code owner March 23, 2026 15:48
@swernli
Copy link
Contributor

swernli commented Mar 23, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swernli
Copy link
Contributor

swernli commented Mar 24, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swernli swernli enabled auto-merge (squash) March 24, 2026 01:07
@swernli swernli merged commit ded0cf2 into microsoft:main Mar 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants