Created
March 19, 2025 20:05
-
-
Save gregglind/94b00977c2784481983bd40c0aab705a to your computer and use it in GitHub Desktop.
Demonstration of a confusion change between Pyright 1.1.396 and 1.1.397
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pyright: strict | |
""" | |
uv run --with "pyright==1.1.396" pyright -> No errors | |
uv run --with "pyright==1.1.397 --> 3 errors, 0 warnings, 0 informations | |
Code changes: https://github.com/microsoft/pyright/compare/1.1.396...1.1.397 | |
""" | |
from typing import Any, TypedDict | |
from pydantic import BaseModel | |
class Obj(object): | |
def __init__(self, dictarg: dict[str, Any]): ... | |
Obj(dictarg=dict(got=[])) # bad | |
Obj(dictarg={"got": []}) # ok | |
class TD(TypedDict): | |
dictarg: dict[str, Any] | |
TD(dictarg={"got": []}) # ok | |
TD(dictarg=dict(got=[])) # bad | |
class PydanticModel(BaseModel): | |
dictarg: dict[str, Any] | |
PydanticModel(dictarg={"got": []}) # ok | |
PydanticModel(dictarg=dict(got=[])) # bad |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment