Skip to content

Let issubclass narrow Any#21165

Draft
hauntsaninja wants to merge 2 commits intopython:masterfrom
hauntsaninja:narrowissub
Draft

Let issubclass narrow Any#21165
hauntsaninja wants to merge 2 commits intopython:masterfrom
hauntsaninja:narrowissub

Conversation

@hauntsaninja
Copy link
Copy Markdown
Collaborator

Fixes #10680

@hauntsaninja hauntsaninja marked this pull request as ready for review April 4, 2026 00:19
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Diff from mypy_primer, showing the effect of this PR on open source code:

psycopg (https://github.com/psycopg/psycopg)
+ tests/types/test_composite.py:401: error: Too many arguments for "tuple"  [call-arg]

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/config/__init__.py:2159: error: Redundant cast to "type[Warning]"  [redundant-cast]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/compat/pickle_compat.py:90: error: Incompatible types in assignment (expression has type "type[PeriodArray]", variable has type "type[BaseOffset]")  [assignment]
+ pandas/compat/pickle_compat.py:104: error: Too many arguments for "__new__" of "object"  [call-arg]
+ pandas/compat/pickle_compat.py:107: error: Too many arguments for "__new__" of "object"  [call-arg]
+ pandas/compat/pickle_compat.py:107: error: Incompatible types in assignment (expression has type "TimedeltaArray", variable has type "DatetimeArray")  [assignment]
+ pandas/compat/pickle_compat.py:109: error: Incompatible types in assignment (expression has type "BlockManager", variable has type "DatetimeArray")  [assignment]

pylint (https://github.com/pycqa/pylint)
+ pylint/lint/pylinter.py:97: error: Unused "type: ignore" comment  [unused-ignore]

poetry (https://github.com/python-poetry/poetry)
+ src/poetry/plugins/plugin_manager.py:106: error: Argument 1 to "_add_plugin" of "PluginManager" has incompatible type "Plugin | ApplicationPlugin"; expected "Plugin"  [arg-type]

mkdocs (https://github.com/mkdocs/mkdocs)
+ mkdocs/config/config_options.py:1156: error: Statement is unreachable  [unreachable]

static-frame (https://github.com/static-frame/static-frame)
+ static_frame/core/interface.py:1436: error: Incompatible types in assignment (expression has type "IndexHierarchy[*tuple[Any, ...]]", variable has type "TypeBlocks")  [assignment]
+ static_frame/core/interface.py:1438: error: Incompatible types in assignment (expression has type "IndexYearMonth | IndexYear | IndexDate", variable has type "TypeBlocks")  [assignment]
+ static_frame/core/interface.py:1440: error: Incompatible types in assignment (expression has type "Frame[Any, Any, *tuple[Any, ...]]", variable has type "TypeBlocks")  [assignment]

@hauntsaninja hauntsaninja marked this pull request as draft April 4, 2026 01:12
@hauntsaninja
Copy link
Copy Markdown
Collaborator Author

poetry is true positive, mkdocs is true positive, pylint is good, pytest is good
static-frame is an redefinition kind of issue, same with pandas i think
psycopg is unhelpful

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.

issubclass() assertions not narrowing types

1 participant