]> granicus.if.org Git - python/commitdiff
Fix module deprecation warnings to have a useful stacklevel
authorBrett Cannon <brett@python.org>
Fri, 27 Mar 2015 16:56:57 +0000 (12:56 -0400)
committerBrett Cannon <brett@python.org>
Fri, 27 Mar 2015 16:56:57 +0000 (12:56 -0400)
Lib/formatter.py
Lib/imp.py

index cc2f4ad18b100bff734c162460719c0f02a40c6a..5e8e2ff377307cdfa297cb8f4618ee6b568b57a2 100644 (file)
@@ -21,7 +21,7 @@ manage and inserting data into the output.
 import sys
 import warnings
 warnings.warn('the formatter module is deprecated and will be removed in '
-              'Python 3.6', DeprecationWarning)
+              'Python 3.6', DeprecationWarning, stacklevel=2)
 
 
 AS_IS = None
index 59ce41cc0a2dd01c6f3863f4a00c8c8aee32a66d..3e6752a11b5746bcf81015ec036d3853f21d7b35 100644 (file)
@@ -29,7 +29,7 @@ import warnings
 
 warnings.warn("the imp module is deprecated in favour of importlib; "
               "see the module's documentation for alternative uses",
-              PendingDeprecationWarning)
+              PendingDeprecationWarning, stacklevel=2)
 
 # DEPRECATED
 SEARCH_ERROR = 0