Skip to content

Different results in Python 3.12.1 vs Python 3.12.2 #335

Closed
@tfeldmann

Description

@tfeldmann

Small reproducer:

from dataclasses import dataclass

from typing_extensions import Protocol, runtime_checkable


@runtime_checkable  # removing this decorator fixes the bug.
class HasConfig(Protocol):
    pass

@runtime_checkable
class Action(HasConfig, Protocol):
    pass

@dataclass
class Delete:
    pass

delete = Delete()
print(isinstance(delete, Action))

This prints False in 3.12.2, True in 3.12.1. Changing the import to from typing import Protocol, runtime_checkable also makes this bug disappear.

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