Skip to content

pyright 1.1.409 fails as a pre-commit hook #11404

@bersbersbers

Description

@bersbersbers

Describe the bug
pyright 1.1.409 fails in pre-commit while it works just fine in stand-alone mode. pyright 1.1.408 works fine everywhere.

Code or Screenshots

mkdir Bug
cd Bug
git init
uv venv
.venv\Scripts\activate

uv pip install pyright==1.1.409 pre-commit

echo repos: [{repo: https://github.com/RobertCraigie/pyright-python, rev: v1.1.409, hooks: [{id: pyright}]}] > .pre-commit-config.yaml
pre-commit install

echo p: int ^| None > bug.py
git add bug.py

pyright bug.py
pre-commit run pyright --all-files

Output:

(Bug) C:\Git\Bug>pyright bug.py
0 errors, 0 warnings, 0 informations

(Bug) C:\Git\Bug>pre-commit run pyright --all-files
pyright..................................................................Failed
- hook id: pyright
- exit code: 1

c:\Git\Bug\bug.py
  c:\Git\Bug\bug.py:1:4 - error: Operator "|" not supported for types "type[int]" and "type[Unknown]" (reportOperatorIssue)
1 error, 0 warnings, 0 informations

VS Code extension or command-line
pyright 1.1.409 via pyright-python

This is a regression from 1.1.408.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions