From 7f874fce630605027adc4f44e89e84569353216a Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 10 May 2008 21:20:19 +0000 Subject: Deprecate the dl module for removal in 3.0. --- Doc/library/dl.rst | 5 +++++ Lib/test/test_dl.py | 5 ++--- Lib/test/test_py3kwarn.py | 2 +- Modules/dlmodule.c | 4 ++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Doc/library/dl.rst b/Doc/library/dl.rst index de641e3..5578120 100644 --- a/Doc/library/dl.rst +++ b/Doc/library/dl.rst @@ -5,6 +5,11 @@ .. module:: dl :platform: Unix :synopsis: Call C functions in shared objects. + :deprecated: + +.. deprecated:: 2.6 + The dl module has been removed in Python 3.0. + .. sectionauthor:: Moshe Zadka The :mod:`dl` module defines an interface to the :cfunc:`dlopen` function, which diff --git a/Lib/test/test_dl.py b/Lib/test/test_dl.py index a2e4460..c04bc1b 100755 --- a/Lib/test/test_dl.py +++ b/Lib/test/test_dl.py @@ -2,9 +2,8 @@ """Test dlmodule.c Roger E. Masse revised strategy by Barry Warsaw """ - -import dl -from test.test_support import verbose,TestSkipped +from test.test_support import verbose,TestSkipped, import_module +dl = import_module('dl', deprecated=True) sharedlibs = [ ('/usr/lib/libc.so', 'getpid'), diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index 991d5cf..30f1668 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -132,7 +132,7 @@ class TestStdlibRemovals(unittest.TestCase): 'Bastion', 'compiler', 'dircache') inclusive_platforms = {'irix':('pure',)} # XXX Don't know if lib-tk is only installed if _tkinter is built. - optional_modules = ('bsddb185', 'Canvas') + optional_modules = ('bsddb185', 'Canvas', 'dl') def check_removal(self, module_name, optional=False): """Make sure the specified module, when imported, raises a diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c index 2b50ed6..112e635 100644 --- a/Modules/dlmodule.c +++ b/Modules/dlmodule.c @@ -235,6 +235,10 @@ initdl(void) { PyObject *m, *d, *x; + if (PyErr_WarnPy3k("the dl module has been removed in " + "Python 3.0", 2) < 0) + return; + /* Initialize object type */ Py_TYPE(&Dltype) = &PyType_Type; -- cgit v0.12