diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2015-05-21 20:40:54 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2015-05-21 20:40:54 (GMT) |
commit | b5601586223f13f77a16ed64f16bea1ece063997 (patch) | |
tree | 6c7dbdf8ce0123a8d55a809c83feb8746b686fb9 | |
parent | d854aacaa9dbc2098957fee043571ebd52d210cd (diff) | |
download | cpython-b5601586223f13f77a16ed64f16bea1ece063997.zip cpython-b5601586223f13f77a16ed64f16bea1ece063997.tar.gz cpython-b5601586223f13f77a16ed64f16bea1ece063997.tar.bz2 |
Set stacklevel to 2 to get more accurate warning messages from deprecated functions.
-rw-r--r-- | Lib/inspect.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 4aa95da..cbf38e7 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -2662,7 +2662,8 @@ class Signature: """Constructs Signature for the given python function.""" 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) @classmethod @@ -2670,7 +2671,8 @@ class Signature: """Constructs Signature for the given builtin function.""" 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) @classmethod |