diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-05-08 19:26:08 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-05-08 19:26:08 (GMT) |
commit | 9d4418242757f616ca7041409c7015e166b2c9f9 (patch) | |
tree | b9c710661263d4a496a94b101ecb0ecf6d5ed897 | |
parent | 80bb9d92e3fdf671cb4f8ffeaadcaa1dedbe7876 (diff) | |
download | cpython-9d4418242757f616ca7041409c7015e166b2c9f9.zip cpython-9d4418242757f616ca7041409c7015e166b2c9f9.tar.gz cpython-9d4418242757f616ca7041409c7015e166b2c9f9.tar.bz2 |
The mutex module has been deprecated for removal in 3.0.
-rw-r--r-- | Doc/library/mutex.rst | 5 | ||||
-rw-r--r-- | Lib/mutex.py | 3 | ||||
-rw-r--r-- | Lib/test/test_mutex.py | 4 | ||||
-rw-r--r-- | Lib/test/test_py3kwarn.py | 2 | ||||
-rw-r--r-- | Lib/test/test_support.py | 13 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
6 files changed, 26 insertions, 3 deletions
diff --git a/Doc/library/mutex.rst b/Doc/library/mutex.rst index 151f0c1..ed0ad92 100644 --- a/Doc/library/mutex.rst +++ b/Doc/library/mutex.rst @@ -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> diff --git a/Lib/mutex.py b/Lib/mutex.py index 5d35bdf..9e6b8d4 100644 --- a/Lib/mutex.py +++ b/Lib/mutex.py @@ -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 diff --git a/Lib/test/test_mutex.py b/Lib/test/test_mutex.py index 6318c70..15e5449 100644 --- a/Lib/test/test_mutex.py +++ b/Lib/test/test_mutex.py @@ -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): diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index 0b0b92d..7e284e5 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -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 diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 04a0ab8..fe5cf0f 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -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 @@ -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 |