Skip to content

Commit 6727c87

Browse files
author
brett.cannon
committed
Deprecate the pure module for 3.0.
git-svn-id: http://svn.python.org/projects/python/trunk@62962 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 3a0f464 commit 6727c87

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

Lib/test/test_py3kwarn.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ class TestStdlibRemovals(unittest.TestCase):
129129
# test.testall not tested as it executes all unit tests as an
130130
# import side-effect.
131131
all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new')
132+
inclusive_platforms = {'irix':('pure',)}
132133

133-
def check_removal(self, module_name):
134+
def check_removal(self, module_name, optional=False):
134135
"""Make sure the specified module, when imported, raises a
135136
DeprecationWarning and specifies itself in the message."""
136137
original_module = None
@@ -145,6 +146,9 @@ def check_removal(self, module_name):
145146
__import__(module_name, level=0)
146147
except DeprecationWarning as exc:
147148
self.assert_(module_name in exc.args[0])
149+
except ImportError:
150+
if not optional:
151+
raise
148152
else:
149153
self.fail("DeprecationWarning not raised for %s" %
150154
module_name)
@@ -159,6 +163,11 @@ def test_platform_independent_removals(self):
159163
for module_name in self.all_platforms:
160164
self.check_removal(module_name)
161165

166+
def test_platform_specific_removals(self):
167+
# Test the removal of platform-specific modules.
168+
for module_name in self.inclusive_platforms.get(sys.platform, []):
169+
self.check_removal(module_name, optional=True)
170+
162171
def test_os_path_walk(self):
163172
msg = "In 3.x, os.path.walk is removed in favor of os.walk."
164173
def dumbo(where, names, args): pass

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Extension Modules
2323
Library
2424
-------
2525

26+
- The pure module has been deprecated for removal in Python 3.0.
27+
2628
- Issue #2487: change the semantics of math.ldexp(x, n) when n is too
2729
large to fit in a C long. ldexp(x, n) now returns a zero (with
2830
suitable sign) if n is large and negative; previously, it raised

Modules/puremodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,10 @@ initpure()
951951
{
952952
PyObject *m, *d;
953953

954+
if (PyErr_WarnPy3k("the pure module has been removed in "
955+
"Python 3.0", 2) < 0)
956+
return;
957+
954958
m = Py_InitModule("pure", pure_methods);
955959
if (m == NULL)
956960
return;

0 commit comments

Comments
 (0)