Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 39411f6

Browse files
committed
Issue #13248, issue #8540: Remove deprecated Context._clamp attribute from Decimal module.
1 parent 037ffbf commit 39411f6

3 files changed

Lines changed: 5 additions & 34 deletions

File tree

Lib/decimal.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3903,28 +3903,6 @@ def copy(self):
39033903
return nc
39043904
__copy__ = copy
39053905

3906-
# _clamp is provided for backwards compatibility with third-party
3907-
# code. May be removed in Python >= 3.3.
3908-
def _get_clamp(self):
3909-
"_clamp mirrors the clamp attribute. Its use is deprecated."
3910-
import warnings
3911-
warnings.warn('Use of the _clamp attribute is deprecated. '
3912-
'Please use clamp instead.',
3913-
DeprecationWarning)
3914-
return self.clamp
3915-
3916-
def _set_clamp(self, clamp):
3917-
"_clamp mirrors the clamp attribute. Its use is deprecated."
3918-
import warnings
3919-
warnings.warn('Use of the _clamp attribute is deprecated. '
3920-
'Please use clamp instead.',
3921-
DeprecationWarning)
3922-
self.clamp = clamp
3923-
3924-
# don't bother with _del_clamp; no sane 3rd party code should
3925-
# be deleting the _clamp attribute
3926-
_clamp = property(_get_clamp, _set_clamp)
3927-
39283906
def _raise_error(self, condition, explanation = None, *args):
39293907
"""Handles an error
39303908

Lib/test/test_decimal.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,18 +1834,9 @@ def test__clamp(self):
18341834
# only, the attribute should be gettable/settable via both
18351835
# `clamp` and `_clamp`; in Python 3.3, `_clamp` should be
18361836
# removed.
1837-
c = Context(clamp = 0)
1838-
self.assertEqual(c.clamp, 0)
1839-
1840-
with check_warnings(("", DeprecationWarning)):
1841-
c._clamp = 1
1842-
self.assertEqual(c.clamp, 1)
1843-
with check_warnings(("", DeprecationWarning)):
1844-
self.assertEqual(c._clamp, 1)
1845-
c.clamp = 0
1846-
self.assertEqual(c.clamp, 0)
1847-
with check_warnings(("", DeprecationWarning)):
1848-
self.assertEqual(c._clamp, 0)
1837+
c = Context()
1838+
with self.assertRaises(AttributeError):
1839+
clamp_value = c._clamp
18491840

18501841
def test_abs(self):
18511842
c = Context()

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ Core and Builtins
338338
Library
339339
-------
340340

341+
- Issue #8540: Remove deprecated Context._clamp attribute in Decimal module.
342+
341343
- Issue #13235: Added PendingDeprecationWarning to warn() method and function.
342344

343345
- Issue #9168: now smtpd is able to bind privileged port.

0 commit comments

Comments
 (0)