summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorPhilip Jenvey <pjenvey@underboss.org>2009-05-08 02:28:39 (GMT)
committerPhilip Jenvey <pjenvey@underboss.org>2009-05-08 02:28:39 (GMT)
commitd846f1d4c21f4589966512f78a4a4d74f8399d6d (patch)
treeb0133d10453f7707201fa5328cd9ddd14e13a6ba /Lib
parent6f9977852ff61be2f55f82bbdb92e486c23d2dd9 (diff)
downloadcpython-d846f1d4c21f4589966512f78a4a4d74f8399d6d.zip
cpython-d846f1d4c21f4589966512f78a4a4d74f8399d6d.tar.gz
cpython-d846f1d4c21f4589966512f78a4a4d74f8399d6d.tar.bz2
#4351: more appropriate DeprecationWarning stacklevels
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/cgi.py4
-rw-r--r--Lib/commands.py2
-rw-r--r--Lib/gzip.py2
-rw-r--r--Lib/macpath.py3
-rw-r--r--Lib/ntpath.py3
-rw-r--r--Lib/plistlib.py15
-rw-r--r--Lib/posixpath.py3
-rw-r--r--Lib/tarfile.py3
-rw-r--r--Lib/xmllib.py3
9 files changed, 22 insertions, 16 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index 0bb5b8ea..fd30383 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -181,14 +181,14 @@ 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 urlparse.parse_qs \
- instead",PendingDeprecationWarning)
+ instead", PendingDeprecationWarning, 2)
return urlparse.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 urlparse.parse_qsl instead",
- PendingDeprecationWarning)
+ PendingDeprecationWarning, 2)
return urlparse.parse_qsl(qs, keep_blank_values, strict_parsing)
def parse_multipart(fp, pdict):
diff --git a/Lib/commands.py b/Lib/commands.py
index ccaaaee..d0e8dd5 100644
--- a/Lib/commands.py
+++ b/Lib/commands.py
@@ -37,7 +37,7 @@ __all__ = ["getstatusoutput","getoutput","getstatus"]
def getstatus(file):
"""Return output of "ls -ld <file>" in a string."""
import warnings
- warnings.warn("commands.getstatus() is deprecated", DeprecationWarning)
+ warnings.warn("commands.getstatus() is deprecated", DeprecationWarning, 2)
return getoutput('ls -ld' + mkarg(file))
diff --git a/Lib/gzip.py b/Lib/gzip.py
index f568796..9605d5d 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -124,7 +124,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/macpath.py b/Lib/macpath.py
index 38e6eae..14e49a3 100644
--- a/Lib/macpath.py
+++ b/Lib/macpath.py
@@ -170,7 +170,8 @@ def walk(top, func, arg):
beyond that arg is always passed to func. It can be used, e.g., to pass
a filename pattern, or a mutable object designed to accumulate
statistics. Passing None for arg is common."""
- warnings.warnpy3k("In 3.x, os.path.walk is removed in favor of os.walk.")
+ warnings.warnpy3k("In 3.x, os.path.walk is removed in favor of os.walk.",
+ stacklevel=2)
try:
names = os.listdir(top)
except os.error:
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index 714f205..37f32f0 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -250,7 +250,8 @@ def walk(top, func, arg):
beyond that arg is always passed to func. It can be used, e.g., to pass
a filename pattern, or a mutable object designed to accumulate
statistics. Passing None for arg is common."""
- warnings.warnpy3k("In 3.x, os.path.walk is removed in favor of os.walk.")
+ warnings.warnpy3k("In 3.x, os.path.walk is removed in favor of os.walk.",
+ stacklevel=2)
try:
names = os.listdir(top)
except os.error:
diff --git a/Lib/plistlib.py b/Lib/plistlib.py
index 05a6ae8..0b1748c 100644
--- a/Lib/plistlib.py
+++ b/Lib/plistlib.py
@@ -114,7 +114,8 @@ def writePlistToString(rootObject):
def readPlistFromResource(path, restype='plst', resid=0):
"""Read plst resource from the resource fork of path.
"""
- warnings.warnpy3k("In 3.x, readPlistFromResource is removed.")
+ warnings.warnpy3k("In 3.x, readPlistFromResource is removed.",
+ stacklevel=2)
from Carbon.File import FSRef, FSGetResourceForkName
from Carbon.Files import fsRdPerm
from Carbon import Res
@@ -129,7 +130,7 @@ def readPlistFromResource(path, restype='plst', resid=0):
def writePlistToResource(rootObject, path, restype='plst', resid=0):
"""Write 'rootObject' as a plst resource to the resource fork of path.
"""
- warnings.warnpy3k("In 3.x, writePlistToResource is removed.")
+ warnings.warnpy3k("In 3.x, writePlistToResource is removed.", stacklevel=2)
from Carbon.File import FSRef, FSGetResourceForkName
from Carbon.Files import fsRdWrPerm
from Carbon import Res
@@ -300,13 +301,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):
@@ -316,14 +317,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(Dict, self).__init__(**kwargs)
@@ -336,7 +337,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(Plist, self).__init__(**kwargs)
def fromFile(cls, pathOrFile):
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 0ec430d..15be83c 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -216,7 +216,8 @@ def walk(top, func, arg):
beyond that arg is always passed to func. It can be used, e.g., to pass
a filename pattern, or a mutable object designed to accumulate
statistics. Passing None for arg is common."""
- warnings.warnpy3k("In 3.x, os.path.walk is removed in favor of os.walk.")
+ warnings.warnpy3k("In 3.x, os.path.walk is removed in favor of os.walk.",
+ stacklevel=2)
try:
names = os.listdir(top)
except os.error:
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 1861664..893d486 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -1588,7 +1588,8 @@ class TarFile(object):
return self.format == USTAR_FORMAT
def _setposix(self, value):
import warnings
- warnings.warn("use the format attribute instead", DeprecationWarning)
+ warnings.warn("use the format attribute instead", DeprecationWarning,
+ 2)
if value:
self.format = USTAR_FORMAT
else:
diff --git a/Lib/xmllib.py b/Lib/xmllib.py
index 2a189cd..96ee841 100644
--- a/Lib/xmllib.py
+++ b/Lib/xmllib.py
@@ -6,7 +6,8 @@ import re
import string
import warnings
-warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", DeprecationWarning)
+warnings.warn("The xmllib module is obsolete. Use xml.sax instead.",
+ DeprecationWarning, 2)
del warnings
version = '0.3'