From 2224817cdf2dd1bfd3efd8a0498f0c996fbc133e Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 16 May 2008 00:10:24 +0000 Subject: [PATCH] Deprecate sunaudiodev/SUNAUDIODEV for removal in 3.0. --- Lib/plat-sunos5/SUNAUDIODEV.py | 3 +++ Lib/test/test_py3kwarn.py | 4 +++- Lib/test/test_sunaudiodev.py | 4 ++-- Misc/NEWS | 3 +++ Modules/sunaudiodev.c | 4 ++++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Lib/plat-sunos5/SUNAUDIODEV.py b/Lib/plat-sunos5/SUNAUDIODEV.py index 632139f87d9..25599bb882b 100755 --- a/Lib/plat-sunos5/SUNAUDIODEV.py +++ b/Lib/plat-sunos5/SUNAUDIODEV.py @@ -1,6 +1,9 @@ # Symbolic constants for use with sunaudiodev module # The names are the same as in audioio.h with the leading AUDIO_ # removed. +from warnings import warnpy3k +warnpy3k("the SUNAUDIODEV module has been removed in Python 3.0", stacklevel=2) +del warnpy3k # Not all values are supported on all releases of SunOS. diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index b35314f12ff..2561f2a4783 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -151,7 +151,9 @@ class TestStdlibRemovals(unittest.TestCase): 'Explorer', 'Finder', 'Netscape', 'StdSuites', 'SystemEvents', 'Terminal', 'cfmfile', 'bundlebuilder', 'buildtools', - 'ColorPicker')} + 'ColorPicker'), + 'sunos5' : ('sunaudiodev', 'SUNAUDIODEV'), + } optional_modules = ('bsddb185', 'Canvas', 'dl', 'linuxaudiodev', 'imageop', 'sv') diff --git a/Lib/test/test_sunaudiodev.py b/Lib/test/test_sunaudiodev.py index 470fff82ec1..2c5e7d4a6e0 100644 --- a/Lib/test/test_sunaudiodev.py +++ b/Lib/test/test_sunaudiodev.py @@ -1,5 +1,5 @@ -from test.test_support import findfile, TestFailed, TestSkipped -import sunaudiodev +from test.test_support import findfile, TestFailed, TestSkipped, import_module +sunaudiodev = import_module('sunaudiodev', deprecated=True) import os try: diff --git a/Misc/NEWS b/Misc/NEWS index 7d3dcff75ca..95eeb2d4802 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,9 @@ Extension Modules Library ------- +- The sunaudiodev and SUNAUDIODEV modules have been deprecated for removal in + Python 3.0. + - The WAIT module from IRIX has been deprecated for removal in Python 3.0. - The torgb module from IRIX has been deprecated for removal in Python 3.0. diff --git a/Modules/sunaudiodev.c b/Modules/sunaudiodev.c index 9f4c344f4c0..285dc66ddda 100644 --- a/Modules/sunaudiodev.c +++ b/Modules/sunaudiodev.c @@ -452,6 +452,10 @@ void initsunaudiodev(void) { PyObject *m, *d; + + if (PyErr_WarnPy3k("the sunaudiodev module has been removed in " + "Python 3.0", 2) < 0) + return; m = Py_InitModule("sunaudiodev", sunaudiodev_methods); if (m == NULL)