Describe the bug
Newly released version 1.1.395 don't distinguish typing that depends on argument values, using typing overload decorator.
(I apologize if the behavior is the one expected)
Code or Screenshots
Example using pd.read function that output a pd.DataFrame by default and a TextFileReader if argument chunksize is not None .
import pandas as pd
y = pd.read_csv("test.csv")
len(y)
y can only be a DataFrame
pyright output:
backend/pyright_bug_reproduction.py:4:5 - error: Argument of type "DataFrame | TextFileReader" cannot be assigned to parameter "obj" of type "Sized" in function "len"
Type "DataFrame | TextFileReader" is not assignable to type "Sized"
"TextFileReader" is incompatible with protocol "Sized"
"__len__" is not present (reportArgumentType)
pandas version is 2.2.3.
VS Code preview screenshots of types:


Describe the bug
Newly released version 1.1.395 don't distinguish typing that depends on argument values, using typing overload decorator.
(I apologize if the behavior is the one expected)
Code or Screenshots
Example using
pd.readfunction that output apd.DataFrameby default and aTextFileReaderif argumentchunksizeis notNone.ycan only be aDataFramepyright output:
pandas version is 2.2.3.
VS Code preview screenshots of types: