[Python-checkins] r72460 - in python/branches/release26-maint: Lib/cgi.py Lib/commands.py Lib/gzip.py Lib/macpath.py Lib/ntpath.py Lib/plistlib.py Lib/posixpath.py Lib/tarfile.py Lib/xmllib.py
philip.jenvey
python-checkins at python.org
Fri May 8 04:47:03 CEST 2009
Author: philip.jenvey
Date: Fri May 8 04:47:02 2009
New Revision: 72460
Log:
Merged revisions 72458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72458 | philip.jenvey | 2009-05-07 19:28:39 -0700 (Thu, 07 May 2009) | 2 lines
#4351: more appropriate DeprecationWarning stacklevels
........
Modified:
python/branches/release26-maint/ (props changed)
python/branches/release26-maint/Lib/cgi.py
python/branches/release26-maint/Lib/commands.py
python/branches/release26-maint/Lib/gzip.py
python/branches/release26-maint/Lib/macpath.py
python/branches/release26-maint/Lib/ntpath.py
python/branches/release26-maint/Lib/plistlib.py
python/branches/release26-maint/Lib/posixpath.py
python/branches/release26-maint/Lib/tarfile.py
python/branches/release26-maint/Lib/xmllib.py
Modified: python/branches/release26-maint/Lib/cgi.py
==============================================================================
--- python/branches/release26-maint/Lib/cgi.py (original)
+++ python/branches/release26-maint/Lib/cgi.py Fri May 8 04:47:02 2009
@@ -181,14 +181,14 @@
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):
Modified: python/branches/release26-maint/Lib/commands.py
==============================================================================
--- python/branches/release26-maint/Lib/commands.py (original)
+++ python/branches/release26-maint/Lib/commands.py Fri May 8 04:47:02 2009
@@ -33,7 +33,7 @@
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))
Modified: python/branches/release26-maint/Lib/gzip.py
==============================================================================
--- python/branches/release26-maint/Lib/gzip.py (original)
+++ python/branches/release26-maint/Lib/gzip.py Fri May 8 04:47:02 2009
@@ -114,7 +114,7 @@
@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
Modified: python/branches/release26-maint/Lib/macpath.py
==============================================================================
--- python/branches/release26-maint/Lib/macpath.py (original)
+++ python/branches/release26-maint/Lib/macpath.py Fri May 8 04:47:02 2009
@@ -170,7 +170,8 @@
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:
Modified: python/branches/release26-maint/Lib/ntpath.py
==============================================================================
--- python/branches/release26-maint/Lib/ntpath.py (original)
+++ python/branches/release26-maint/Lib/ntpath.py Fri May 8 04:47:02 2009
@@ -250,7 +250,8 @@
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:
Modified: python/branches/release26-maint/Lib/plistlib.py
==============================================================================
--- python/branches/release26-maint/Lib/plistlib.py (original)
+++ python/branches/release26-maint/Lib/plistlib.py Fri May 8 04:47:02 2009
@@ -114,7 +114,8 @@
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 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 @@
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 @@
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 @@
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):
Modified: python/branches/release26-maint/Lib/posixpath.py
==============================================================================
--- python/branches/release26-maint/Lib/posixpath.py (original)
+++ python/branches/release26-maint/Lib/posixpath.py Fri May 8 04:47:02 2009
@@ -216,7 +216,8 @@
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:
Modified: python/branches/release26-maint/Lib/tarfile.py
==============================================================================
--- python/branches/release26-maint/Lib/tarfile.py (original)
+++ python/branches/release26-maint/Lib/tarfile.py Fri May 8 04:47:02 2009
@@ -1591,7 +1591,8 @@
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:
Modified: python/branches/release26-maint/Lib/xmllib.py
==============================================================================
--- python/branches/release26-maint/Lib/xmllib.py (original)
+++ python/branches/release26-maint/Lib/xmllib.py Fri May 8 04:47:02 2009
@@ -6,7 +6,8 @@
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'
More information about the Python-checkins
mailing list