[Python-checkins] cpython: Fix module deprecation warnings to have a useful stacklevel
brett.cannon
python-checkins at python.org
Fri Mar 27 17:57:22 CET 2015
https://hg.python.org/cpython/rev/2a336cc29282
changeset: 95223:2a336cc29282
parent: 95220:b0b4c4d365b1
user: Brett Cannon <brett at python.org>
date: Fri Mar 27 12:56:57 2015 -0400
summary:
Fix module deprecation warnings to have a useful stacklevel
files:
Lib/formatter.py | 2 +-
Lib/imp.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Lib/formatter.py b/Lib/formatter.py
--- a/Lib/formatter.py
+++ b/Lib/formatter.py
@@ -21,7 +21,7 @@
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
diff --git a/Lib/imp.py b/Lib/imp.py
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -29,7 +29,7 @@
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
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list