summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Jenvey <pjenvey@underboss.org>2009-05-08 03:57:12 (GMT)
committerPhilip Jenvey <pjenvey@underboss.org>2009-05-08 03:57:12 (GMT)
commita394f2dca300c17c1d70b7d6d005af457550cc8e (patch)
treec3d435abd5bddaad590e105556cafa7c6fec4ecb
parente7d149ecf0ef00902dbb603cafdf20af346a7090 (diff)
downloadcpython-a394f2dca300c17c1d70b7d6d005af457550cc8e.zip
cpython-a394f2dca300c17c1d70b7d6d005af457550cc8e.tar.gz
cpython-a394f2dca300c17c1d70b7d6d005af457550cc8e.tar.bz2
#4351: more appropriate DeprecationWarning stacklevels
-rwxr-xr-xLib/cgi.py4
-rw-r--r--Lib/gzip.py2
-rw-r--r--Lib/plistlib.py10
-rw-r--r--Lib/string.py2
4 files changed, 9 insertions, 9 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index 35f6996..9e16a1d 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -163,13 +163,13 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
"""Parse a query given as a string argument."""
warn("cgi.parse_qs is deprecated, use urllib.parse.parse_qs instead",
- DeprecationWarning)
+ DeprecationWarning, 2)
return urllib.parse.parse_qs(qs, keep_blank_values, strict_parsing)
def parse_qsl(qs, keep_blank_values=0, strict_parsing=0):
"""Parse a query given as a string argument."""
warn("cgi.parse_qsl is deprecated, use urllib.parse.parse_qsl instead",
- DeprecationWarning)
+ DeprecationWarning, 2)
return urllib.parse.parse_qsl(qs, keep_blank_values, strict_parsing)
def parse_multipart(fp, pdict):
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 019c3e2..983e0ce 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -136,7 +136,7 @@ class GzipFile:
@property
def filename(self):
import warnings
- warnings.warn("use the name attribute", DeprecationWarning)
+ warnings.warn("use the name attribute", DeprecationWarning, 2)
if self.mode == WRITE and self.name[-3:] != ".gz":
return self.name + ".gz"
return self.name
diff --git a/Lib/plistlib.py b/Lib/plistlib.py
index 0cd32ad..2084b5f 100644
--- a/Lib/plistlib.py
+++ b/Lib/plistlib.py
@@ -263,13 +263,13 @@ class _InternalDict(dict):
raise AttributeError(attr)
from warnings import warn
warn("Attribute access from plist dicts is deprecated, use d[key] "
- "notation instead", PendingDeprecationWarning)
+ "notation instead", PendingDeprecationWarning, 2)
return value
def __setattr__(self, attr, value):
from warnings import warn
warn("Attribute access from plist dicts is deprecated, use d[key] "
- "notation instead", PendingDeprecationWarning)
+ "notation instead", PendingDeprecationWarning, 2)
self[attr] = value
def __delattr__(self, attr):
@@ -279,14 +279,14 @@ class _InternalDict(dict):
raise AttributeError(attr)
from warnings import warn
warn("Attribute access from plist dicts is deprecated, use d[key] "
- "notation instead", PendingDeprecationWarning)
+ "notation instead", PendingDeprecationWarning, 2)
class Dict(_InternalDict):
def __init__(self, **kwargs):
from warnings import warn
warn("The plistlib.Dict class is deprecated, use builtin dict instead",
- PendingDeprecationWarning)
+ PendingDeprecationWarning, 2)
super().__init__(**kwargs)
@@ -299,7 +299,7 @@ class Plist(_InternalDict):
def __init__(self, **kwargs):
from warnings import warn
warn("The Plist class is deprecated, use the readPlist() and "
- "writePlist() functions instead", PendingDeprecationWarning)
+ "writePlist() functions instead", PendingDeprecationWarning, 2)
super().__init__(**kwargs)
def fromFile(cls, pathOrFile):
diff --git a/Lib/string.py b/Lib/string.py
index 8667c0e..e071a2d 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -51,7 +51,7 @@ def maketrans(frm: bytes, to: bytes) -> bytes:
"""
import warnings
warnings.warn("string.maketrans is deprecated, use bytes.maketrans instead",
- DeprecationWarning)
+ DeprecationWarning, 2)
if len(frm) != len(to):
raise ValueError("maketrans arguments must have same length")
if not (isinstance(frm, bytes) and isinstance(to, bytes)):