Skip to content

pyupgrade39-plus breaks inspect.isclass for <= python3.10 #967

@commonism

Description

@commonism

The following

from typing import Dict
import inspect
assert inspect.isclass(Dict[str, str]) is False

is rewritten as

import inspect
assert inspect.isclass(dict[str, str]) is False

which is broken for python3.10 (and 3.9 too I guess).

Traceback (most recent call last):
  File "/tmp/pyupgrade39.py", line 8, in <module>
    assert inspect.isclass(dict[str, str]) is False
AssertionError

it works for 3.11+

Same problem for list, tuple.

related issue: python/cpython#88459
related pr: python/cpython#93754

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions