[Python-checkins] cpython: Issue #13248, issue #8540: Remove deprecated Context._clamp attribute from

mark.dickinson python-checkins at python.org
Mon Oct 24 11:32:03 CEST 2011


http://hg.python.org/cpython/rev/221638ba5d2a
changeset:   73091:221638ba5d2a
user:        Mark Dickinson <mdickinson at enthought.com>
date:        Mon Oct 24 10:31:52 2011 +0100
summary:
  Issue #13248, issue #8540: Remove deprecated Context._clamp attribute from Decimal module.

files:
  Lib/decimal.py           |  22 ----------------------
  Lib/test/test_decimal.py |  15 +++------------
  Misc/NEWS                |   2 ++
  3 files changed, 5 insertions(+), 34 deletions(-)


diff --git a/Lib/decimal.py b/Lib/decimal.py
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -3903,28 +3903,6 @@
         return nc
     __copy__ = copy
 
-    # _clamp is provided for backwards compatibility with third-party
-    # code.  May be removed in Python >= 3.3.
-    def _get_clamp(self):
-        "_clamp mirrors the clamp attribute.  Its use is deprecated."
-        import warnings
-        warnings.warn('Use of the _clamp attribute is deprecated. '
-                      'Please use clamp instead.',
-                      DeprecationWarning)
-        return self.clamp
-
-    def _set_clamp(self, clamp):
-        "_clamp mirrors the clamp attribute.  Its use is deprecated."
-        import warnings
-        warnings.warn('Use of the _clamp attribute is deprecated. '
-                      'Please use clamp instead.',
-                      DeprecationWarning)
-        self.clamp = clamp
-
-    # don't bother with _del_clamp;  no sane 3rd party code should
-    # be deleting the _clamp attribute
-    _clamp = property(_get_clamp, _set_clamp)
-
     def _raise_error(self, condition, explanation = None, *args):
         """Handles an error
 
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -1834,18 +1834,9 @@
         # only, the attribute should be gettable/settable via both
         # `clamp` and `_clamp`; in Python 3.3, `_clamp` should be
         # removed.
-        c = Context(clamp = 0)
-        self.assertEqual(c.clamp, 0)
-
-        with check_warnings(("", DeprecationWarning)):
-            c._clamp = 1
-        self.assertEqual(c.clamp, 1)
-        with check_warnings(("", DeprecationWarning)):
-            self.assertEqual(c._clamp, 1)
-        c.clamp = 0
-        self.assertEqual(c.clamp, 0)
-        with check_warnings(("", DeprecationWarning)):
-            self.assertEqual(c._clamp, 0)
+        c = Context()
+        with self.assertRaises(AttributeError):
+            clamp_value = c._clamp
 
     def test_abs(self):
         c = Context()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -338,6 +338,8 @@
 Library
 -------
 
+- Issue #8540: Remove deprecated Context._clamp attribute in Decimal module.
+
 - Issue #13235: Added PendingDeprecationWarning to warn() method and function.
 
 - Issue #9168: now smtpd is able to bind privileged port.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list