[Python-checkins] MNT: set stacklevel in the getfullargspec deprecation warning to 2 (GH-13029)

Pablo Galindo webhook-mailer at python.org
Wed May 1 11:12:50 EDT 2019


https://github.com/python/cpython/commit/18029d80bde1743da6900600633f0fa54d7c1044
commit: 18029d80bde1743da6900600633f0fa54d7c1044
branch: master
author: Thomas A Caswell <tcaswell at gmail.com>
committer: Pablo Galindo <Pablogsal at gmail.com>
date: 2019-05-01T11:12:34-04:00
summary:

MNT: set stacklevel in the getfullargspec deprecation warning to 2 (GH-13029)

This is consistent with the rest of the `warnings.warn` usage in the
inspect.py module and aids identifying code that needs to be fixed.

This warning came in via d5d2b4546939b98244708e5bb0cfccd55b99d244

files:
M Lib/inspect.py

diff --git a/Lib/inspect.py b/Lib/inspect.py
index fffca22357a9..c460309bb5a1 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1112,7 +1112,7 @@ def getfullargspec(func):
     """
 
     warnings.warn("Use inspect.signature() instead of inspect.getfullargspec()",
-                  DeprecationWarning)
+                  DeprecationWarning, stacklevel=2)
     try:
         # Re: `skip_bound_arg=False`
         #



More information about the Python-checkins mailing list