Cause posixfile to raise a DeprecationWarning. Documented as deprecated since
authorBrett Cannon <bcannon@gmail.com>
Sun, 20 May 2007 23:57:38 +0000 (23:57 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sun, 20 May 2007 23:57:38 +0000 (23:57 +0000)
Ptyhon 1.5.

Lib/posixfile.py
Lib/test/test_sundry.py
Misc/NEWS

index 763c605c95f04a6c2de9e10ecb7bbc96d2f4b7f7..2fa600fdf33c4fe2c8b99e63e67e07a424004db6 100644 (file)
@@ -52,7 +52,9 @@ f.lock(mode [, len [, start [, whence]]])
       note: - the '?' modifier prevents a region from being locked; it is
               query only
 """
-
+import warnings
+warnings.warn("The posixfile module is deprecated; "
+                "fcntl.lockf() provides better locking", DeprecationWarning, 2)
 
 class _posixfile_:
     """File wrapper class that provides extra POSIX file routines."""
index 42ee2574bb5dfd82261ba5e6c4feaf8e716347f3..5711fb216ebe6afe156f4d9adb9d79f7ef8652e1 100644 (file)
@@ -1,71 +1,74 @@
 """Do a minimal test of all the modules that aren't otherwise tested."""
 
+from test.test_support import guard_warnings_filter
 import warnings
-warnings.filterwarnings('ignore', r".*posixfile module",
-                        DeprecationWarning, 'posixfile$')
 
-from test.test_support import verbose
+with guard_warnings_filter():
+    warnings.filterwarnings('ignore', r".*posixfile",
+                            DeprecationWarning)
 
-import BaseHTTPServer
-import DocXMLRPCServer
-import CGIHTTPServer
-import SimpleHTTPServer
-import SimpleXMLRPCServer
-import aifc
-import audiodev
-import bdb
-import cgitb
-import cmd
-import code
-import compileall
-import encodings
-import formatter
-import ftplib
-import getpass
-import htmlentitydefs
-import ihooks
-import imghdr
-import imputil
-import keyword
-import linecache
-import macurl2path
-import mailcap
-import mimify
-import mutex
-import nntplib
-import nturl2path
-import opcode
-import os2emxpath
-import pdb
-import pipes
-#import poplib
-import posixfile
-import pstats
-import py_compile
-import pydoc
-import rexec
-import rlcompleter
-import sched
-import smtplib
-import sndhdr
-import statvfs
-import stringold
-import sunau
-import sunaudio
-import symbol
-import tabnanny
-import telnetlib
-import timeit
-import toaiff
-import token
-try:
-    import tty     # not available on Windows
-except ImportError:
-    if verbose:
-        print "skipping tty"
+    from test.test_support import verbose
 
-# Can't test the "user" module -- if the user has a ~/.pythonrc.py, it
-# can screw up all sorts of things (esp. if it prints!).
-#import user
-import webbrowser
-import xml
+    import BaseHTTPServer
+    import DocXMLRPCServer
+    import CGIHTTPServer
+    import SimpleHTTPServer
+    import SimpleXMLRPCServer
+    import aifc
+    import audiodev
+    import bdb
+    import cgitb
+    import cmd
+    import code
+    import compileall
+    import encodings
+    import formatter
+    import ftplib
+    import getpass
+    import htmlentitydefs
+    import ihooks
+    import imghdr
+    import imputil
+    import keyword
+    import linecache
+    import macurl2path
+    import mailcap
+    import mimify
+    import mutex
+    import nntplib
+    import nturl2path
+    import opcode
+    import os2emxpath
+    import pdb
+    import pipes
+    #import poplib
+    import posixfile
+    import pstats
+    import py_compile
+    import pydoc
+    import rexec
+    import rlcompleter
+    import sched
+    import smtplib
+    import sndhdr
+    import statvfs
+    import stringold
+    import sunau
+    import sunaudio
+    import symbol
+    import tabnanny
+    import telnetlib
+    import timeit
+    import toaiff
+    import token
+    try:
+        import tty     # not available on Windows
+    except ImportError:
+        if verbose:
+            print "skipping tty"
+
+    # Can't test the "user" module -- if the user has a ~/.pythonrc.py, it
+    # can screw up all sorts of things (esp. if it prints!).
+    #import user
+    import webbrowser
+    import xml
index 10564faf618653612144e0630df4da7c4b43194d..264e5e790c0edd55fba86f1eff208dadd5ce2895 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -211,6 +211,8 @@ Core and builtins
 Library
 -------
 
+- The posixfile module now raises a DeprecationWarning.
+
 - Remove the gopherlib module.  This also leads to the removal of gopher
   support in urllib/urllib2.