Commit b5601586 authored by Berker Peksag's avatar Berker Peksag

Set stacklevel to 2 to get more accurate warning messages from deprecated functions.

parent d854aaca
...@@ -2662,7 +2662,8 @@ class Signature: ...@@ -2662,7 +2662,8 @@ class Signature:
"""Constructs Signature for the given python function.""" """Constructs Signature for the given python function."""
warnings.warn("inspect.Signature.from_function() is deprecated, " warnings.warn("inspect.Signature.from_function() is deprecated, "
"use Signature.from_callable()", DeprecationWarning) "use Signature.from_callable()",
DeprecationWarning, stacklevel=2)
return _signature_from_function(cls, func) return _signature_from_function(cls, func)
@classmethod @classmethod
...@@ -2670,7 +2671,8 @@ class Signature: ...@@ -2670,7 +2671,8 @@ class Signature:
"""Constructs Signature for the given builtin function.""" """Constructs Signature for the given builtin function."""
warnings.warn("inspect.Signature.from_builtin() is deprecated, " warnings.warn("inspect.Signature.from_builtin() is deprecated, "
"use Signature.from_callable()", DeprecationWarning) "use Signature.from_callable()",
DeprecationWarning, stacklevel=2)
return _signature_from_builtin(cls, func) return _signature_from_builtin(cls, func)
@classmethod @classmethod
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment