]> granicus.if.org Git - python/commitdiff
The mutex module has been deprecated for removal in 3.0.
authorBrett Cannon <bcannon@gmail.com>
Thu, 8 May 2008 19:26:08 +0000 (19:26 +0000)
committerBrett Cannon <bcannon@gmail.com>
Thu, 8 May 2008 19:26:08 +0000 (19:26 +0000)
Doc/library/mutex.rst
Lib/mutex.py
Lib/test/test_mutex.py
Lib/test/test_py3kwarn.py
Lib/test/test_support.py
Misc/NEWS

index 151f0c1261795f24d8c88037bed480f7a0bccb50..ed0ad92a1feeb35abebf7828221f1cd83e28a8d5 100644 (file)
@@ -4,6 +4,11 @@
 
 .. module:: mutex
    :synopsis: Lock and queue for mutual exclusion.
+   :deprecated:
+   
+.. deprecated::
+   The mutex module has been removed in Python 3.0.
+
 .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
 
 
index 5d35bdf6ab0928380da79003873638ff33c426c4..9e6b8d43c7b5b3258ac0dfcfba040050df1d92aa 100644 (file)
@@ -11,6 +11,9 @@ implying it now has the lock.
 Of course, no multi-threading is implied -- hence the funny interface
 for lock, where a function is called once the lock is aquired.
 """
+from warnings import warnpy3k
+warnpy3k("the mutex module has been removed in Python 3.0", stacklevel=2)
+del warnpy3k
 
 from collections import deque
 
index 6318c70a8edc5b7fcf762ea60d62c056a491fee2..15e5449231ece109765cbc7ce0f3e07d3d62fbb5 100644 (file)
@@ -1,8 +1,8 @@
-import mutex
-
 import unittest
 import test.test_support
 
+mutex = test.test_support.import_module("mutex", deprecated=True)
+
 class MutexTest(unittest.TestCase):
 
     def setUp(self):
index 0b0b92d8d658d02587d5ca8ca1ab5d4cf4b4dc54..7e284e5a3f6186bc5289c73eb40cf4ce7d446f00 100644 (file)
@@ -126,7 +126,7 @@ class TestPy3KWarnings(unittest.TestCase):
 
 class TestStdlibRemovals(unittest.TestCase):
 
-    all_platforms = ('audiodev', 'imputil')
+    all_platforms = ('audiodev', 'imputil', 'mutex')
 
     def check_removal(self, module_name):
         """Make sure the specified module, when imported, raises a
index 04a0ab85740081b117ca6bddbc7ab8971cb97b2d..fe5cf0fd3d5d7383524308083125c7de282e9e27 100644 (file)
@@ -37,6 +37,19 @@ class ResourceDenied(TestSkipped):
     and unexpected skips.
     """
 
+def import_module(name, deprecated=False):
+    """Import the module to be tested, raising TestSkipped if it is not
+    available."""
+    with catch_warning():
+        if deprecated:
+            warnings.filterwarnings("ignore", ".+ module", DeprecationWarning)
+        try:
+            module = __import__(name, level=0)
+        except ImportError:
+            raise TestSkipped("No module named " + name)
+        else:
+            return module
+
 verbose = 1              # Flag set to 0 by regrtest.py
 use_resources = None     # Flag set to [] by regrtest.py
 max_memuse = 0           # Disable bigmem tests (they will still be run with
index 7d634b660903275f85fb3c976f1d9edf203ed939..770676d228a71b4a86d58eab0e1a79bd12a7a39f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -18,6 +18,8 @@ Extension Modules
 Library
 -------
 
+- The mutex module has bene deprecated for removal in Python 3.0.
+
 - The imputil module has been deprecated for removal in Python 3.0.
 
 Build