This commit is contained in:
parent
037ffbf182
commit
39411f60a2
|
@ -3903,28 +3903,6 @@ class Context(object):
|
||||||
return nc
|
return nc
|
||||||
__copy__ = copy
|
__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):
|
def _raise_error(self, condition, explanation = None, *args):
|
||||||
"""Handles an error
|
"""Handles an error
|
||||||
|
|
||||||
|
|
|
@ -1834,18 +1834,9 @@ class ContextAPItests(unittest.TestCase):
|
||||||
# only, the attribute should be gettable/settable via both
|
# only, the attribute should be gettable/settable via both
|
||||||
# `clamp` and `_clamp`; in Python 3.3, `_clamp` should be
|
# `clamp` and `_clamp`; in Python 3.3, `_clamp` should be
|
||||||
# removed.
|
# removed.
|
||||||
c = Context(clamp = 0)
|
c = Context()
|
||||||
self.assertEqual(c.clamp, 0)
|
with self.assertRaises(AttributeError):
|
||||||
|
clamp_value = c._clamp
|
||||||
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)
|
|
||||||
|
|
||||||
def test_abs(self):
|
def test_abs(self):
|
||||||
c = Context()
|
c = Context()
|
||||||
|
|
|
@ -338,6 +338,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #8540: Remove deprecated Context._clamp attribute in Decimal module.
|
||||||
|
|
||||||
- Issue #13235: Added PendingDeprecationWarning to warn() method and function.
|
- Issue #13235: Added PendingDeprecationWarning to warn() method and function.
|
||||||
|
|
||||||
- Issue #9168: now smtpd is able to bind privileged port.
|
- Issue #9168: now smtpd is able to bind privileged port.
|
||||||
|
|
Loading…
Reference in New Issue