MCPcopy Index your code
hub / github.com/python/cpython / _deprecated

Function _deprecated

Lib/_py_warnings.py:873–889  ·  view source on GitHub ↗

Warn that *name* is deprecated or should be removed. RuntimeError is raised if *remove* specifies a major/minor tuple older than the current Python version or the same version but past the alpha. The *message* argument is formatted with *name* and *remove* as a Python version tuple

(name, message=_DEPRECATED_MSG, *, remove, _version=sys.version_info)

Source from the content-addressed store, hash-verified

871
872
873def _deprecated(name, message=_DEPRECATED_MSG, *, remove, _version=sys.version_info):
874 """Warn that *name* is deprecated or should be removed.
875
876 RuntimeError is raised if *remove* specifies a major/minor tuple older than
877 the current Python version or the same version but past the alpha.
878
879 The *message* argument is formatted with *name* and *remove* as a Python
880 version tuple (e.g. (3, 11)).
881
882 """
883 remove_formatted = f"{remove[0]}.{remove[1]}"
884 if (_version[:2] > remove) or (_version[:2] == remove and _version[3] != "alpha"):
885 msg = f"{name!r} was slated for removal after Python {remove_formatted} alpha"
886 raise RuntimeError(msg)
887 else:
888 msg = message.format(name=name, remove=remove_formatted)
889 _wm.warn(msg, DeprecationWarning, stacklevel=3)
890
891
892# Private utility function called by _PyErr_WarnUnawaitedCoroutine

Callers 15

__getattr__Function · 0.90
__getattr__Function · 0.90
__getattr__Function · 0.90
__getattr__Function · 0.90
__getattr__Function · 0.90
__getattr__Function · 0.90
add_typeMethod · 0.90
__getattr__Function · 0.90
__getattr__Function · 0.90
__getattr__Function · 0.90
__getattr__Function · 0.90
__getattr__Function · 0.90

Calls 2

formatMethod · 0.45
warnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…