Skip to content

@deprecated (PEP 702) on a compiled function or method makes the module fail at import #1243

Open
python/mypy
#22163

Description

@rheard

mypy supports typing_extensions.deprecated / warnings.deprecated and type checks this, but the compiled
module can't be imported:

from typing_extensions import deprecated

@deprecated("use other()")
def top() -> int:
    return 2

class C:
    @deprecated("use g()")
    def f(self) -> int:
        return 1
AttributeError: 'builtin_function_or_method' object has no attribute '__deprecated__'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions