Content-Length: 293058 | pFad | https://github.com/python/cpython/issues/138010

B3 warnings.deprecated leads to incorrectly set _is_protocol on subclasses · Issue #138010 · python/cpython · GitHub
Skip to content

warnings.deprecated leads to incorrectly set _is_protocol on subclasses #138010

@hmwillson

Description

@hmwillson

Bug report

Bug description:

from warnings import deprecated
from typing import Protocol


class FooProtocol(Protocol):
    pass

class Base:
    pass

@deprecated("")
class DeprecatedBase:
    pass

class FooWithBase(Base, FooProtocol):
    pass

class FooWithDeprecatedBase(DeprecatedBase, FooProtocol):
    pass


assert FooWithBase._is_protocol is False
assert FooWithDeprecatedBase._is_protocol is True

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/138010

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy