From: Brett Cannon Date: Sat, 13 Jan 2007 00:29:49 +0000 (+0000) Subject: Deprecate the sets module. X-Git-Tag: v2.6a1~2284 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=093b67061ac54b603483fed1038d686b34cc61f5;p=python Deprecate the sets module. --- diff --git a/Doc/lib/libsets.tex b/Doc/lib/libsets.tex index 22bf34bfb4..efa4e0f3b9 100644 --- a/Doc/lib/libsets.tex +++ b/Doc/lib/libsets.tex @@ -9,6 +9,8 @@ \sectionauthor{Raymond D. Hettinger}{python@rcn.com} \versionadded{2.3} +\deprecated{2.6}{ The built-in \code{set}/\code{frozneset} types replace this +module.} The \module{sets} module provides classes for constructing and manipulating unordered collections of unique elements. Common uses include membership diff --git a/Lib/sets.py b/Lib/sets.py index 32a0dd64ff..99ee931d9b 100644 --- a/Lib/sets.py +++ b/Lib/sets.py @@ -80,6 +80,10 @@ except ImportError: __all__ = ['BaseSet', 'Set', 'ImmutableSet'] +import warnings +warnings.warn("the sets module is deprecated", DeprecationWarning, + stacklevel=2) + class BaseSet(object): """Common base class for mutable and immutable sets.""" diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index c45e13997a..dbc6bc31da 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -9,6 +9,8 @@ warnings.filterwarnings("ignore", "the gopherlib module is deprecated", DeprecationWarning, "") +warnings.filterwarnings("ignore", "the sets module is deprecated", + DeprecationWarning, "") class AllTest(unittest.TestCase): diff --git a/Lib/test/test_sets.py b/Lib/test/test_sets.py index 85e4a22e84..efa388f3df 100644 --- a/Lib/test/test_sets.py +++ b/Lib/test/test_sets.py @@ -1,5 +1,9 @@ #!/usr/bin/env python +import warnings +warnings.filterwarnings("ignore", "the sets module is deprecated", + DeprecationWarning, "test\.test_sets") + import unittest, operator, copy, pickle, random from sets import Set, ImmutableSet from test import test_support diff --git a/Misc/NEWS b/Misc/NEWS index 0319fc1adb..754ceae53f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -109,6 +109,9 @@ Core and builtins Library ------- +- The sets module has been deprecated. Use the built-in set/frozenset types + instead. + - Bug #1610795: make ctypes.util.find_library work on BSD systems. - Fixes for 64-bit Windows: In ctypes.wintypes, correct the